[variant] make_recursive_variant and std::map

I would like to be able to use a recursive variant similar to the way it's shown in the documentation but using a std::map instead of std::vector. i.e. boost::make_recursive_variant< int,std::map<float,boost::recursive_variant_>
::type var;
Is there a way to do this? VC8.1 complains with: utility(54) : error C2079: 'std::pair<_Ty1,_Ty2>::second' uses undefined struct 'boost::recursive_variant_' with [ _Ty1=const float, _Ty2=boost::recursive_variant_ ] Regards, Richard.

On 12/15/06, Richard Crossley <rdc@rdcdesign.com> wrote:
boost::make_recursive_variant< int,std::map<float,boost::recursive_variant_>
::type var;
Is there a way to do this?
Sure. You've got it.
VC8.1 complains with: utility(54) : error C2079: 'std::pair<_Ty1,_Ty2>::second' uses undefined struct 'boost::recursive_variant_' with [ _Ty1=const float, _Ty2=boost::recursive_variant_ ]
What does your code look like that generates this error? Its not coming from the make_recursive_variant typedef, but some usage of it. You probably need to introduce one or two other typedefs that don't reference the "recursive_variant_" type. See the attached test program that creates a recursive variant like yours, populates it, and prints the contents using a static visitor. -- Caleb Epstein

No joy. With your code I get exactly the same error. This is VC8 with SP1 installed and using cvs head. Trying with Intel 9.1 I see the same problem. C:\Program Files\Microsoft Visual Studio 8\VC\include\utility(54): error: incomplete type is not allowed _Ty2 second; // the second stored value ^ detected during: instantiation of class "std::pair<_Ty1, _Ty2> [with _Ty1=const float, _Ty2=boost::recursive_variant_]" at line 258 of "C:\Program Files\Microsoft Visual Studio 8\VC\include\xtree" instantiation of "std::_Tree<_Traits>::_Ctptr std::_Tree<_Traits>::const_iterator::operator->() const [with _Traits=std::_Tmap_traits<float, element, std::less<float>, std::allocator<std::pair<const float, element>>, false>]" Regards, Richard.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Caleb Epstein Sent: 18 December 2006 15:14 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [variant] make_recursive_variant and std::map
On 12/15/06, Richard Crossley <rdc@rdcdesign.com> wrote:
boost::make_recursive_variant< int,std::map<float,boost::recursive_variant_>
::type var;
Is there a way to do this?
Sure. You've got it.
VC8.1 complains with: utility(54) : error C2079: 'std::pair<_Ty1,_Ty2>::second' uses undefined struct 'boost::recursive_variant_' with [ _Ty1=const float, _Ty2=boost::recursive_variant_ ]
What does your code look like that generates this error? Its not coming from the make_recursive_variant typedef, but some usage of it. You probably need to introduce one or two other typedefs that don't reference the "recursive_variant_" type. See the attached test program that creates a recursive variant like yours, populates it, and prints the contents using a static visitor.
-- Caleb Epstein
participants (2)
-
Caleb Epstein
-
Richard Crossley