Guest User

Untitled

a guest
Nov 24th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. template <typename Attribute, typename ActualAttribute>
  2. struct make_attribute
  3. {
  4. typedef typename remove_const<Attribute>::type attribute_type;
  5. typedef typename
  6. mpl::if_<
  7. is_same<typename remove_const<ActualAttribute>::type, unused_type>
  8. , attribute_type
  9. , ActualAttribute&>::type
  10. type;
  11.  
  12. typedef typename
  13. mpl::if_<
  14. is_same<typename remove_const<ActualAttribute>::type, unused_type>
  15. , attribute_type
  16. , ActualAttribute>::type
  17. value_type;
  18.  
  19. static Attribute call(unused_type)
  20. {
  21. // synthesize the attribute/parameter
  22. return boost::get(value_initialized<attribute_type>());
  23. }
  24.  
  25. template <typename T>
  26. static T& call(T& value)
  27. {
  28. return value; // just pass the one provided
  29. }
  30. };
Add Comment
Please, Sign In to add comment