How to get the behavior of make_recursive_variant ?

Hello I am constructing a data structure with STL containers and tuples and containers ..., so all inner memebers/components are unnamed (tuples use only indexes for element access, and so do STL containers, if at all) At a certain point my structure is recursive as it needs to hold a tree of (variables and maps and lists of (variables and maps and lists of (...))) boost::make_recursive_variant< >::type can serve my purpose well, except that I do not need a variant in my structure, I just need the structure to be recursive. Is there a way to get the recursive-definition behavior of make_recursive_variant<>, without the variant ? Also I am curios: how is such a recursive definition possible ? How does make_recursive_variant implement it ? Thank you, Timothy Madden

Quoting Timothy Madden
boost::make_recursive_variant< >::type can serve my purpose well, except that I do not need a variant in my structure, I just need the structure to be recursive. Is there a way to get the recursive-definition behavior of make_recursive_variant<>, without the variant ?
Also I am curios: how is such a recursive definition possible ? How does make_recursive_variant implement it ?
Sounds like a job for boost::recursive_wrapper, which variant uses under the hood.

On 07/07/10 06:32, Peter Bartlett wrote:
Quoting Timothy Madden
: boost::make_recursive_variant< >::type can serve my purpose well, except that I do not need a variant in my structure, I just need the structure to be recursive. Is there a way to get the recursive-definition behavior of make_recursive_variant<>, without the variant ?
Also I am curios: how is such a recursive definition possible ? How does make_recursive_variant implement it ?
Sounds like a job for boost::recursive_wrapper, which variant uses under the hood. Like in the attached?

Peter Bartlett wrote:
Quoting Timothy Madden
: boost::make_recursive_variant< >::type can serve my purpose well, except that I do not need a variant in my structure, I just need the structure to be recursive. Is there a way to get the recursive-definition behavior of make_recursive_variant<>, without the variant ?
Also I am curios: how is such a recursive definition possible ? How does make_recursive_variant implement it ?
Sounds like a job for boost::recursive_wrapper, which variant uses under the hood.
I would like the possibility to create the type in-place, which make_recursive_variant offers (recursive_wrapper requires a type already declared). Timothy Madden
participants (3)
-
Larry Evans
-
Peter Bartlett
-
Timothy Madden