Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:27

0001 /*
0002  *          Copyright Andrey Semashev 2007 - 2015.
0003  * Distributed under the Boost Software License, Version 1.0.
0004  *    (See accompanying file LICENSE_1_0.txt or copy at
0005  *          http://www.boost.org/LICENSE_1_0.txt)
0006  */
0007 /*!
0008  * \file   bind_assign.hpp
0009  * \author Andrey Semashev
0010  * \date   30.03.2008
0011  *
0012  * This header contains a function object that assigns the received value to the bound object.
0013  * This is a lightweight alternative to what Boost.Phoenix and Boost.Lambda provides.
0014  */
0015 
0016 #ifndef BOOST_LOG_UTILITY_FUNCTIONAL_BIND_ASSIGN_HPP_INCLUDED_
0017 #define BOOST_LOG_UTILITY_FUNCTIONAL_BIND_ASSIGN_HPP_INCLUDED_
0018 
0019 #include <boost/log/detail/config.hpp>
0020 #include <boost/log/utility/functional/bind.hpp>
0021 #include <boost/log/detail/header.hpp>
0022 
0023 #ifdef BOOST_HAS_PRAGMA_ONCE
0024 #pragma once
0025 #endif
0026 
0027 namespace boost {
0028 
0029 BOOST_LOG_OPEN_NAMESPACE
0030 
0031 //! The function object that assigns its second operand to the first one
0032 struct assign_fun
0033 {
0034     typedef void result_type;
0035 
0036     template< typename LeftT, typename RightT >
0037     void operator() (LeftT& assignee, RightT const& val) const
0038     {
0039         assignee = val;
0040     }
0041 };
0042 
0043 template< typename AssigneeT >
0044 BOOST_FORCEINLINE binder1st< assign_fun, AssigneeT& > bind_assign(AssigneeT& assignee)
0045 {
0046     return binder1st< assign_fun, AssigneeT& >(assign_fun(), assignee);
0047 }
0048 
0049 BOOST_LOG_CLOSE_NAMESPACE // namespace log
0050 
0051 } // namespace boost
0052 
0053 #include <boost/log/detail/footer.hpp>
0054 
0055 #endif // BOOST_LOG_UTILITY_FUNCTIONAL_BIND_ASSIGN_HPP_INCLUDED_