|
Boost : |
From: Brian Braatz (brianb_at_[hidden])
Date: 2005-06-18 00:33:23
CLOSER (see below)
> -----Original Message-----
> From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]]
> On Behalf Of Ryan
> Sent: Friday, June 17, 2005 9:24 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] MPL: set<> not fully supporting compile time
> iteration?
>
> Brian Braatz <brianb <at> rmtg.com> writes:
> > [snip]
> > // copy it to a vector
> > typedef mpl::copy
> > <
> > myset::type
> > , back_inserter< vec >
> >
> > >::type result_vec;
> >
> > mpl::for_each<result_vec>( print_type());
> > }
> > ...
>
> Try:
>
> typedef mpl::copy
> <
> mpl::begin<myset>
> , mpl::back_inserter<vec>
> >::type result_vec;
>
> HTH
>
> -Ryan
>
[Brian Braatz Writes:]
THANK YOU RYAN- I am compiling now (one step closer)
But I am still not getting the expected (??) behavior
here is the current code
struct A {};
struct B {};
struct C {};
struct D {};
struct print_type
{
template <typename T>
void operator()(T const& v) const
{
std::cout << "[ " << typeid(v).name() << " ] ";
}
};
typedef mpl::set3<A,B,C> myset;
typedef mpl::vector<> vec;
// copy it to a vector
typedef mpl::copy
<
mpl::begin<myset>
, back_inserter< vec >
>::type result_vec;
// Prints "0"
cout << "result_vec size " << mpl::size<result_vec>::value << endl;
// prints nothing
mpl::for_each<result_vec>( print_type());
ANYONE- wishing to show me how I did something ABSOLTULEY stupid or
missed some concept- please, by all means
:)
I am starting to believe though that there is something broken with
mpl::set<> (typically developer- blame either the compiler or the
library (grin))
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk