Boost logo

Boost :

From: Brian Braatz (brianb_at_[hidden])
Date: 2005-06-19 11:03:37


IT WORKS! (See below)

> >> -----Original Message-----
[Dave Abrahams Writes:]
> I have checked in a fix for this problem. I even figured out how to
> preprocess the right headers. Yay me!
>
> Well, maybe you should tell me if the fix works for you before I
> strut and celebrate ;-)

[Brian Braatz Writes:]
YES THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU!

here is the original code:
(note to reader from the future, this will NOT work on boost1.32- it
should work on any version following)

// Code sample for how to copy from a mpl::set<> to a mpl::vector<>
// prints the names of the resulting vector
struct print_type
{
    template <typename T>
    void operator()(T const& v) const
    {
        std::cout << "[ " << typeid(v).name() << " ] ";
    }
};

struct A {};
struct B {};
struct C {};
struct D {};

    typedef mpl::set3<A,B,C> myset;
    typedef mpl::vector<> vec;
    
    // copy a set to a vector
    typedef mpl::copy
    <
         myset
        , back_inserter< vec::type >

>::type result_vec;
    
    // Prints "3"
    cout << "result_vec size " << mpl::size<result_vec>::value << endl;
    
    // prints "[ struct C ] [ struct B ] [ struct A ] "
    mpl::for_each<result_vec::type>( print_type());

THANK YOU DAVID- This is a huge help. :)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk