is_placeholder_expr.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* Copyright 2006-2009 Joaquin M Lopez Munoz.
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * http://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * See http://www.boost.org/libs/flyweight for library home page.
  7. */
  8. #ifndef BOOST_FLYWEIGHT_DETAIL_IS_PLACEHOLDER_EXPR_HPP
  9. #define BOOST_FLYWEIGHT_DETAIL_IS_PLACEHOLDER_EXPR_HPP
  10. #if defined(_MSC_VER)
  11. #pragma once
  12. #endif
  13. #include <boost/type_traits/is_same.hpp>
  14. #include <boost/mpl/apply.hpp>
  15. #include <boost/mpl/aux_/lambda_support.hpp>
  16. #include <boost/mpl/not.hpp>
  17. #include <boost/preprocessor/facilities/intercept.hpp>
  18. #include <boost/preprocessor/repetition/enum_params.hpp>
  19. namespace boost{
  20. namespace flyweights{
  21. namespace detail{
  22. /* is_placeholder_expression<T> indicates whether T is an
  23. * MPL placeholder expression.
  24. */
  25. template<typename T>
  26. struct is_placeholder_expression_helper
  27. {
  28. template<
  29. BOOST_PP_ENUM_PARAMS(
  30. BOOST_MPL_LIMIT_METAFUNCTION_ARITY,typename BOOST_PP_INTERCEPT)
  31. >
  32. struct apply{
  33. typedef int type;
  34. };
  35. BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_placeholder_expression_helper,(T))
  36. };
  37. template<typename T>
  38. struct is_placeholder_expression:
  39. mpl::not_<is_same<
  40. typename mpl::apply<
  41. is_placeholder_expression_helper<T>,
  42. BOOST_PP_ENUM_PARAMS(
  43. BOOST_MPL_LIMIT_METAFUNCTION_ARITY,int BOOST_PP_INTERCEPT)
  44. >::type,
  45. int
  46. > >
  47. {};
  48. } /* namespace flyweights::detail */
  49. } /* namespace flyweights */
  50. } /* namespace boost */
  51. #endif