adding struct associative adaptor

[SVN r37638]
This commit is contained in:
Dan Marsden
2007-05-08 22:14:58 +00:00
parent 8b2e69c764
commit f8bb69dc9a
5 changed files with 251 additions and 0 deletions

View File

@ -37,6 +37,30 @@ namespace boost { namespace fusion { namespace extension
struct struct_size<Struct const>
: struct_size<Struct>
{};
struct no_such_member;
template<typename Struct, typename Key>
struct struct_assoc_member
{
typedef no_such_member type;
};
template<typename Struct, typename Key>
struct struct_assoc_member<Struct const, Key>
{
typedef typename
add_const<typename struct_assoc_member<Struct, Key>::type>::type
type;
static type&
call(Struct const& struct_)
{
return struct_member<Struct, Key>::call(
const_cast<Struct&>(struct_));
}
};
}}}
#endif