/Src/Dependencies/Boost/boost/proto/functional/fusion/push_back.hpp

http://hadesmem.googlecode.com/ · C++ Header · 49 lines · 30 code · 7 blank · 12 comment · 0 complexity · 1780d67788533eac75b6fbeed2e3ac21 MD5 · raw file

  1. ///////////////////////////////////////////////////////////////////////////////
  2. /// \file push_back.hpp
  3. /// Proto callables Fusion push_back
  4. //
  5. // Copyright 2010 Eric Niebler. Distributed under the Boost
  6. // Software License, Version 1.0. (See accompanying file
  7. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. #ifndef BOOST_PROTO_FUNCTIONAL_FUSION_PUSH_BACK_HPP_EAN_11_27_2010
  9. #define BOOST_PROTO_FUNCTIONAL_FUSION_PUSH_BACK_HPP_EAN_11_27_2010
  10. #include <boost/type_traits/add_const.hpp>
  11. #include <boost/type_traits/remove_const.hpp>
  12. #include <boost/type_traits/remove_reference.hpp>
  13. #include <boost/fusion/include/push_back.hpp>
  14. #include <boost/proto/proto_fwd.hpp>
  15. namespace boost { namespace proto { namespace functional
  16. {
  17. /// \brief A PolymorphicFunctionObject type that invokes the
  18. /// \c fusion::push_back() algorithm on its argument.
  19. ///
  20. /// A PolymorphicFunctionObject type that invokes the
  21. /// \c fusion::push_back() algorithm on its argument.
  22. struct push_back
  23. {
  24. BOOST_PROTO_CALLABLE()
  25. template<typename Sig>
  26. struct result;
  27. template<typename This, typename Seq, typename T>
  28. struct result<This(Seq, T)>
  29. : fusion::result_of::push_back<
  30. typename boost::add_const<typename boost::remove_reference<Seq>::type>::type
  31. , typename boost::remove_const<typename boost::remove_reference<T>::type>::type
  32. >
  33. {};
  34. template<typename Seq, typename T>
  35. typename fusion::result_of::push_back<Seq const, T>::type
  36. operator ()(Seq const &seq, T const &t) const
  37. {
  38. return fusion::push_back(seq, t);
  39. }
  40. };
  41. }}}
  42. #endif