
AMDG Istvan Buki wrote:
1) Is MPL the right tool to transform a call to get_value< general, age >( a_person ) into fusion::at_key< general::age >( fusion::at_key< general >( a_person ) )
No not really.
2) If it is, could someone provide me some help on how to achieve such a result?
Here's a modified form of your example. I couldn't get the variadic
syntax to compile, so
there is a numeral tacked onto the end of the function name.
#include
general_person ;
typedef fusion::map < fusion::pair< fields::address::street, std::string >, fusion::pair< fields::address::postal_code, std::string >, fusion::pair< fields::address::country, std::string >
address_person ;
typedef fusion::map < fusion::pair< fields::general, general_person >, fusion::pair< fields::address, address_person >
person ;
int main() { using namespace fields ; general_person gp = fusion::make_map< general::first_name, general::last_name, general::age >( "John", "Doe", 99 ) ; address_person ap = fusion::make_map< address::street, address::postal_code, address::country >( "Foo street 1", "12345", "Barland" ) ; person a_person = fusion::make_map< general, address >( gp, ap ) ; std::cout << "Age: " // << fusion::at_key< general::age >( fusion::at_key< general >( a_person ) ) << at_key2< general, general::age>( a_person ) << std::endl ; return 0 ; } In Christ, Steven Watanabe