Boost logo

Boost :

From: Richard Crossley (rdc_at_[hidden])
Date: 2006-12-29 08:40:48

Hi Steve,

Thanks for your help, though I'm somewhat uncertain as to what's going on.
Your example would appear to be able to be simplified further or am I

struct undefined;

template<class T>
struct C {
    T t;

void f(void*){}

int main() {
    C<undefined> * p = 0; // OK
    f(p); // ERROR

Anyway, using your inheritance idea along with Caleb Epstein's sample code
struct map_;
typedef boost::mpl::vector<int,float,std::string>::type key_types;
typedef boost::mpl::push_back<key_types,map_>::type element_types;
typedef boost::make_variant_over<key_types>::type key;
typedef boost::make_variant_over<element_types>::type element;
typedef struct map_ : std::map<key,element>{} map_t;

Will build with VC8SP1. Not as pretty, but it gets things going.



>-----Original Message-----
>From: boost-bounces_at_[hidden] [mailto:boost-
>bounces_at_[hidden]] On Behalf Of Steven Watanabe
>Sent: 29 December 2006 01:00
>To: boost_at_[hidden]
>Subject: Re: [boost] FW: [Boost-users] [variant] make_recursive_variant
>and std::map
>"Richard Crossley" wrote:
>> Cross posted from the boost users list... Can anyone help me out here?
>> Regards,
>> Richard.
>Ok. I've finally figured out what's happening. It looks like
>a compiler bug introduced in sp1. Here is the simplest
>I could reduce it to.
>struct undefined;
>template<class T>
>void f(T) {
>template<class T>
>struct A {
>template<class T>
>struct B {
>template<class T>
>struct C {
> T t;
>int main() {
> f((A<B<C<undefined> > >*)0);
> This causes msvc to instantiate C<undefined>. Note that
>just B<C<undefined> > is not enough. All three templates
>are needed. Qualifying the call to f fixes the problem, so
>this bug appears to be caused by ADL.
>Now for your problem. The function calls that need to be qualified
>are visitation_impl_invoke and visitation_impl_invoke_impl
>in <boost/variant/detail/visitation_impl.hpp>. When I tried that
>it compiled.
>Until this is fixed you can use recursive_wrapper directly.
>struct my_map;
>typedef boost::variant<int, boost::recursive_wrapper<my_map> > element;
>struct my_map : std::map<float, element> {
> my_map(const std::map<float, element>& arg) : std::map<float,
>element>(arg) {}
> friend std::ostream& operator<<(std::ostream& os, const my_map&
>self) {
> os << static_cast<const std::map<float, element>&>(self);
> }
>In Christ,
>Steven Watanabe
>Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at