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 9 #ifndef BOOST_FLYWEIGHT_DETAIL_IS_PLACEHOLDER_EXPR_HPP 10 #define BOOST_FLYWEIGHT_DETAIL_IS_PLACEHOLDER_EXPR_HPP 11 12 #if defined(_MSC_VER) 13 #pragma once 14 #endif 15 16 #include <boost/type_traits/is_same.hpp> 17 #include <boost/mpl/apply.hpp> 18 #include <boost/mpl/aux_/lambda_support.hpp> 19 #include <boost/mpl/not.hpp> 20 #include <boost/preprocessor/facilities/intercept.hpp> 21 #include <boost/preprocessor/repetition/enum_params.hpp> 22 23 namespace boost{ 24 25 namespace flyweights{ 26 27 namespace detail{ 28 29 /* is_placeholder_expression<T> indicates whether T is an 30 * MPL placeholder expression. 31 */ 32 33 template<typename T> 34 struct is_placeholder_expression_helper 35 { 36 template< 37 BOOST_PP_ENUM_PARAMS( 38 BOOST_MPL_LIMIT_METAFUNCTION_ARITY,typename BOOST_PP_INTERCEPT) 39 > 40 struct apply{ 41 typedef int type; 42 }; 43 44 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_placeholder_expression_helper,(T)) 45 }; 46 47 template<typename T> 48 struct is_placeholder_expression: 49 mpl::not_<is_same< 50 typename mpl::apply< 51 is_placeholder_expression_helper<T>, 52 BOOST_PP_ENUM_PARAMS( 53 BOOST_MPL_LIMIT_METAFUNCTION_ARITY,int BOOST_PP_INTERCEPT) 54 >::type, 55 int 56 > > 57 {}; 58 59 } /* namespace flyweights::detail */ 60 61 } /* namespace flyweights */ 62 63 } /* namespace boost */ 64 65 #endif 66