/*============================================================================= 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 { /////////////////////////////////////////////////////////////////////////// #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable: 4512) // assignment operator could not be generated. #endif 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; }; #ifdef _MSC_VER # pragma warning(pop) #endif }}} #endif