/Src/Dependencies/Boost/boost/variant/detail/make_variant_list.hpp

http://hadesmem.googlecode.com/ · C++ Header · 60 lines · 26 code · 11 blank · 23 comment · 0 complexity · 9ace21d57f82331ccfc1eb99fc47ebf7 MD5 · raw file

  1. //-----------------------------------------------------------------------------
  2. // boost variant/detail/make_variant_list.hpp header file
  3. // See http://www.boost.org for updates, documentation, and revision history.
  4. //-----------------------------------------------------------------------------
  5. //
  6. // Copyright (c) 2002-2003
  7. // Eric Friedman, Itay Maman
  8. //
  9. // Distributed under the Boost Software License, Version 1.0. (See
  10. // accompanying file LICENSE_1_0.txt or copy at
  11. // http://www.boost.org/LICENSE_1_0.txt)
  12. #ifndef BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP
  13. #define BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP
  14. #include "boost/variant/variant_fwd.hpp"
  15. #include "boost/mpl/list.hpp"
  16. #include "boost/preprocessor/cat.hpp"
  17. #include "boost/preprocessor/enum.hpp"
  18. namespace boost {
  19. namespace detail { namespace variant {
  20. ///////////////////////////////////////////////////////////////////////////////
  21. // (detail) metafunction make_variant_list
  22. //
  23. // Provides a MPL-compatible sequence with the specified non-void types
  24. // as arguments.
  25. //
  26. // Rationale: see class template convert_void (variant_fwd.hpp) and using-
  27. // declaration workaround (below).
  28. //
  29. template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
  30. struct make_variant_list
  31. {
  32. public: // metafunction result
  33. // [Define a macro to convert any void(NN) tags to mpl::void...]
  34. # define BOOST_VARIANT_AUX_CONVERT_VOID(z, N,_) \
  35. typename convert_void< BOOST_PP_CAT(T,N) >::type
  36. // [...so that the specified types can be passed to mpl::list...]
  37. typedef typename mpl::list<
  38. BOOST_PP_ENUM(
  39. BOOST_VARIANT_LIMIT_TYPES
  40. , BOOST_VARIANT_AUX_CONVERT_VOID
  41. , _
  42. )
  43. >::type type;
  44. // [...and, finally, the conversion macro can be undefined:]
  45. # undef BOOST_VARIANT_AUX_CONVERT_VOID
  46. };
  47. }} // namespace detail::variant
  48. } // namespace boost
  49. #endif // BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP