Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename Attribute, typename ActualAttribute>
- struct make_attribute
- {
- typedef typename remove_const<Attribute>::type attribute_type;
- typedef typename
- mpl::if_<
- is_same<typename remove_const<ActualAttribute>::type, unused_type>
- , attribute_type
- , ActualAttribute&>::type
- type;
- typedef typename
- mpl::if_<
- is_same<typename remove_const<ActualAttribute>::type, unused_type>
- , attribute_type
- , ActualAttribute>::type
- value_type;
- static Attribute call(unused_type)
- {
- // synthesize the attribute/parameter
- return boost::get(value_initialized<attribute_type>());
- }
- template <typename T>
- static T& call(T& value)
- {
- return value; // just pass the one provided
- }
- };
Add Comment
Please, Sign In to add comment