[boost] [MPL] Several Questions

2002-11-19 Thread David A. Greene
Hi, I'm starting to explore mpl a bit and I ran into a roadblock. If I have a template that takes an argument that can be a sequence (e.g. mpl::vector) or a regular old type, is there any way, short of specialization, to determine whether the parameter is a sequence? I'd like to avoid specializin

Re: [boost] [MPL] Several Questions

2002-11-20 Thread David A. Greene
Aleksey Gurtovoy wrote: there any way, short of specialization, to determine whether the parameter is a sequence? "is_sequence::value", please expect it to appear in the CVS in a day or two :). Oh, fabulous! Just what I ws looking for. Given 'is_sequence', it will be as simple as this:

Re: [boost] Re: [MPL] Several Questions

2002-11-20 Thread David A. Greene
Gennadiy Rozental wrote: 1. merge the sequences. That's easy. 2. Eliminate the duplicates (for example like Loki is doing) That's hard to do efficiently. My MC++D book is packed away at the moment. Can you refresh my memory as to the solution there? Is it better then O(n^2)?

Re: [boost] [MPL] Several Questions

2002-11-25 Thread David A. Greene
Aleksey Gurtovoy wrote: Ok, but what if I don't want to alter first, second and third? That is, I have some set of classes that define types like this but they were never originally intended to represent a sequence. It just happens that I want to maipulate a set of these types formed by the typed

[boost] [MPL] vector of vectors

2002-11-30 Thread David A. Greene
Is it possible to have an MPL vector of MPL vectors? When I try this, the compiler (g++ 3.2) complains about an incomplete type for push_back_traits: #include #include #include int main(void) { typedef boost::mpl::vector<> vec; typedef boost::mpl::push_back< vec, boost::mpl::vect

[boost] [MPL] Making Generators

2002-12-05 Thread David A. Greene
[Posted to boost because MPL is not yet released. At what point should these questions go to boost-users?] Say I have a type my_type: template struct my_type { ... } Now let's say I want to create a generator that binds T to some type but leaves U and V free to be filled in later. Basically,

Re: [boost] [MPL] Making Generators

2002-12-05 Thread David A. Greene
David Abrahams wrote: template struct my_type_generator { template struct apply { typedef my_type type; }; }; Looks good to me. Is there a convenient way to create this with MPL? You want it to be more convenient than that?! Perhaps "convenient" is the wrong word. There a

Re: [boost] [MPL] Making Generators

2002-12-05 Thread David A. Greene
David Abrahams wrote: template struct my_type_generator { typedef my_type type; }; lambda does it Oops, I meant lambda > of course! Ok, that makes more sense now. :) , unless of course your compiler needs BOOST_MPL_AUX_LAMDA_SUPPORT. I don't think it's much of

Re: [boost] [MPL] Making Generators

2002-12-05 Thread David A. Greene
David Abrahams wrote: Your correction above makes everything clear to me now. So do you feel you need an additional library feature? ;-) I suppose not. What I really wanted was the ability to take a regular old template class and create a generator out of it: template struct my_type { ...

Re: [boost] [MPL] Making Generators

2002-12-06 Thread David A. Greene
David Abrahams wrote: I suppose not. What I really wanted was the ability to take a regular old template class and create a generator out of it: template struct my_type { ... } // Note: no ::type member typedef SHAZAM > generator; typedef generator::template apply::type my_type_inst; I want

Re: [boost] [MPL] Making Generators

2002-12-06 Thread David A. Greene
Aleksey Gurtovoy wrote: my_type is not a metafunction so maybe it just can't be used conveniently with mpl. Not now. However, I constantly keep finding more and more use cases to be inclined to provide a built-in library support for this particular metafunction's form - in particular, so that

Re: [boost] [MPL] Making Generators

2002-12-07 Thread David A. Greene
Aleksey Gurtovoy wrote: That's because the MPL's lambda works only with metafunctions which template parameters are _types_, and only types: That's what I suspected. 3) a metafunction with template template parameter, can't be used in lambda expressions: Again, what I suspected. It _is_ p

Re: [boost] Views a.k.a. container_adaptors released to sandbox

2002-12-09 Thread David A. Greene
Roland Richter wrote: I would like to announce that I finally imported the first set of Boost.View classes to the Boost-Sandbox CVS. > + What is it? > A view is a light-weight, immutable decorator to some existing data. > Usually, it will provide the same interface as a STL container. Does th

Re: [boost] Compile-time print

2002-12-09 Thread David A. Greene
Fernando Cacciola wrote: - Original Message - From: "David A. Greene" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 05, 2002 5:10 PM Subject: [boost] Compile-time print Hi gang, Has anyone come across a compile-time print metafuncti

Re: [boost] Re: Views a.k.a. container_adaptors released to sandbox

2002-12-10 Thread David A. Greene
Roland Richter wrote: Does this mean a view is mutable? For example, using Boost.View, can I write a bounded that automatically drops the last element on push_front if size() is at some upper limit value before adding the new element? This is the sort of thing I No. A view is not mutable; s

[boost] [MPL] Making Tuples

2002-12-14 Thread David A. Greene
What's the easiest way of converting an MPL sequence into a tuple type? I seem to recall Dave Abrahams needed this functionality as well. Do I need to construct a bare cons list? -Dave -- "Some little people have music in them, but Fats, he was all music, and you know

Re: [boost] Re: [MPL] Making Tuples

2002-12-16 Thread David A. Greene
Gennadiy Rozental wrote: What's the easiest way of converting an MPL sequence into a tuple type? I seem to recall Dave Abrahams needed this functionality as well. Do I need to construct a bare cons list? Use inherit_linearly like in it's example. Which example is that? Is inherit_linearly

[boost] The Wonder of Tuples

2002-12-16 Thread David A. Greene
Over the weekend I realized just what strange and wonderful things tuples are. This message is as much to get my thoughts recorded as it is a request for discussion about the various classes and bits of code presented within. Some of this stuff may be useful for Boost and some may not. I'd like

Re: [boost] Re: [MPL] Making Tuples

2002-12-16 Thread David A. Greene
Rozental, Gennadiy wrote: Which example is that? Is inherit_linearly documented somewhere? -Dave http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost/boost/libs/mpl/example/ inherit_linearly.cpp?rev=1.1&content-type=text/vnd.viewcvs-markup Well, that's not creating a

Re: [boost] The Wonder of Tuples

2002-12-16 Thread David A. Greene
Rozental, Gennadiy wrote: Over the weekend I had a bit of free time so I wrote up a spanning_iterator based on the iterator_adaptors framework. To throw in a bit more complication, I wanted something generic enough that I could span different kinds of container. There should be a way to While

Re: [boost] Re: The Wonder of Tuples

2002-12-18 Thread David A. Greene
Roland Richter wrote: David A. Greene wrote: The fundamental problem is that it's inconvenient to iterate through a tuple. All we have is the get<> template to access tuple elements. Iterating is again conceptually simple -- just increment an index. But the fact that get<&

Re: [boost] The Wonder of Tuples

2002-12-18 Thread David A. Greene
Aleksey Gurtovoy wrote: David A. Greene wrote: The fundamental problem is that it's inconvenient to iterate through a tuple. 'tuple_ext' ("tuple extensions") make it easier - http://groups.yahoo.com/group/Boost-Users/message/704. Has any discussion taken

Re: [boost] New MPL meta-functions, and a question

2003-01-02 Thread David A. Greene
Aleksey Gurtovoy wrote: That's not to say that it should stay this way. Ideally, to support true mixed-type arithmetic, e.g. 'plus< rational<1,10>, int_c<5> >', the current MPL primitives such as 'plus', 'minus', 'multiply', etc. need a major re-write, to become something along these lines: t

Re: [boost] New MPL meta-functions, and a question

2003-01-03 Thread David A. Greene
Aleksey Gurtovoy wrote: David A. Greene wrote: Aleksey Gurtovoy wrote: Figuring out a reasonable way to specify the promotion rules is probably the hardest part there... I actually did some work on this in the past but it's been sitting on the shelf for a while and probably needs a b

Re: [boost] [MPL] naming question

2003-01-05 Thread David A. Greene
David Abrahams wrote: thought, I am not sure if it's a good choice. Does apply< unarize, list >::type convey the discussed meaning for you? No, but I'm not sure that unroll_args does either. unroll_args doesn't, in fact, unroll arguments. It's a metafunction adapter. "Unroll" is usually

Re: [boost] Re: Preliminary submission: command line & config filelibrary

2003-01-20 Thread David A. Greene
Vladimir Prus wrote: I have one policy that I forgot to mention: chain_lookup_policy. It's work is based on Chain of responcibilities Design pattern. In this case Every parameter knows how to parse itelf out of input. And this identification may not be the name at all. I would say that it's a

Re: [boost] Re: MPL Code bloat on GCC

2003-02-04 Thread David A. Greene
Jaap Suter wrote: Try turning off debug symbols; GCC spends a long time and a lot of disk generating them. Thanks, works excellent! In fact, my GCC object files and executables are the smallest now. Yep, I came to the same conclusion. Unfortunately, it does not help much when you need to deb