2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
9 * \author Andrey Semashev
12 * This header contains function object adapter for compatibility with Boost.Spirit actions interface requirements.
15 #ifndef BOOST_LOG_UTILITY_FUNCTIONAL_AS_ACTION_HPP_INCLUDED_
16 #define BOOST_LOG_UTILITY_FUNCTIONAL_AS_ACTION_HPP_INCLUDED_
18 #include <boost/log/detail/config.hpp>
19 #include <boost/log/detail/header.hpp>
21 #ifdef BOOST_HAS_PRAGMA_ONCE
27 BOOST_LOG_OPEN_NAMESPACE
29 //! Function object adapter for Boost.Spirit actions
30 template< typename FunT >
31 struct as_action_adapter
33 typedef typename FunT::result_type result_type;
35 BOOST_DEFAULTED_FUNCTION(as_action_adapter(), {})
36 explicit as_action_adapter(FunT const& fun) : m_fun(fun) {}
38 template< typename AttributeT, typename ContextT >
39 result_type operator() (AttributeT const& attr, ContextT const& ctx, bool& pass) const
48 template< typename FunT >
49 BOOST_FORCEINLINE as_action_adapter< FunT > as_action(FunT const& fun)
51 return as_action_adapter< FunT >(fun);
54 BOOST_LOG_CLOSE_NAMESPACE // namespace log
58 #include <boost/log/detail/footer.hpp>
60 #endif // BOOST_LOG_UTILITY_FUNCTIONAL_AS_ACTION_HPP_INCLUDED_