/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_SPIRIT_EXPAND_ARG_FEB_19_2007_1107AM) #define BOOST_SPIRIT_EXPAND_ARG_FEB_19_2007_1107AM #if defined(_MSC_VER) #pragma once #endif #include #include #include #include #include #include #include namespace boost { namespace spirit { namespace detail { /////////////////////////////////////////////////////////////////////////// template struct expand_arg { template struct result_type { // This is a temporary hack. The better way is to detect if T // can be called given unused context. typedef typename mpl::eval_if< mpl::or_, traits::is_string > , mpl::identity , boost::result_of >::type type; }; template struct result; template struct result : result_type {}; template struct result : result_type {}; expand_arg(Context& context) : context(context) { } template typename result_type::type call(T const& f, mpl::false_) const { return f(unused, context); } template typename result_type::type call(T const& val, mpl::true_) const { return val; } template typename result_type::type operator()(T const& x) const { return call(x, mpl::or_, traits::is_string >()); } Context& context; private: // silence MSVC warning C4512: assignment operator could not be generated expand_arg& operator= (expand_arg const&); }; }}} #endif