Boost logo

Boost :

From: Brian Braatz (brianb_at_[hidden])
Date: 2005-06-04 16:38:02


Sitting in the backyard.

Beautiful day, got up at 3am to get something figured out (for proposed
boost profiler \ introspection library).

Good news is I figured out the MPL code needed to accomplish my goal.
After typing in an incremental version of the code, I got the dreaded
internal compiler error (ICE).

I am chewing on this- and thought I would post it so to provide an
opportunity for someone to show how incredibly stupid I am because I did
something that was obviously wrong. (you can even rub my nose in it if
you like :) )

here is the code:

I am tearing it apart\deconstructing to try to figure out what is
kicking in the ICE. (I am also going to try it with an eval_if (which I
should be using anyway) just to see what happens)

I am using boost 1.32 and vc7.1

struct do_copy_col
{
    typedef do_copy_col type;
    do_copy_col()
    {
        std::cout << "do_copy_col" << std::endl;
    }
    // todo- implement operator()(dest,src)
};
struct do_not_copy_col
{
    typedef do_not_copy_col type;
    do_not_copy_col()
    {
        std::cout << "do_not_copy_col" << std::endl;
    }
    
    // todo- implement operator()(dest,src)
};

template <class type_t, class sequence_t>
struct copy_col_if_in_dest
: public if_< typename is_same< typename deref<typename
boost::mpl::find<sequence_t, type_t>::type >::type, type_t>,
do_copy_col, do_not_copy_col>::type
{
};

template <class src_t, class dest_t>
void copy_union(src_t & src, dest_t & dest)
{
    copy_col_if_in_dest<boost::mpl::at<src::typelist,
boost::mpl::int_<0> >::type,src::typelist>();
}


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