Chris@16
|
1 /*
|
Chris@101
|
2 * Copyright Andrey Semashev 2007 - 2015.
|
Chris@16
|
3 * Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
4 * (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 * http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 */
|
Chris@16
|
7 /*!
|
Chris@16
|
8 * \file bind_output.hpp
|
Chris@16
|
9 * \author Andrey Semashev
|
Chris@16
|
10 * \date 30.03.2008
|
Chris@16
|
11 *
|
Chris@16
|
12 * This header contains a function object that puts the received value to the bound stream.
|
Chris@16
|
13 * This is a lightweight alternative to what Boost.Phoenix and Boost.Lambda provides.
|
Chris@16
|
14 */
|
Chris@16
|
15
|
Chris@16
|
16 #ifndef BOOST_LOG_UTILITY_FUNCTIONAL_BIND_OUTPUT_HPP_INCLUDED_
|
Chris@16
|
17 #define BOOST_LOG_UTILITY_FUNCTIONAL_BIND_OUTPUT_HPP_INCLUDED_
|
Chris@16
|
18
|
Chris@16
|
19 #include <boost/log/detail/config.hpp>
|
Chris@16
|
20 #include <boost/log/utility/functional/bind.hpp>
|
Chris@16
|
21 #include <boost/log/detail/header.hpp>
|
Chris@16
|
22
|
Chris@16
|
23 #ifdef BOOST_HAS_PRAGMA_ONCE
|
Chris@16
|
24 #pragma once
|
Chris@16
|
25 #endif
|
Chris@16
|
26
|
Chris@16
|
27 namespace boost {
|
Chris@16
|
28
|
Chris@16
|
29 BOOST_LOG_OPEN_NAMESPACE
|
Chris@16
|
30
|
Chris@16
|
31 //! The function object that outputs its second operand to the first one
|
Chris@16
|
32 struct output_fun
|
Chris@16
|
33 {
|
Chris@16
|
34 typedef void result_type;
|
Chris@16
|
35
|
Chris@16
|
36 template< typename StreamT, typename T >
|
Chris@16
|
37 void operator() (StreamT& strm, T const& val) const
|
Chris@16
|
38 {
|
Chris@16
|
39 strm << val;
|
Chris@16
|
40 }
|
Chris@16
|
41 };
|
Chris@16
|
42
|
Chris@16
|
43 template< typename StreamT >
|
Chris@16
|
44 BOOST_FORCEINLINE binder1st< output_fun, StreamT& > bind_output(StreamT& strm)
|
Chris@16
|
45 {
|
Chris@16
|
46 return binder1st< output_fun, StreamT& >(output_fun(), strm);
|
Chris@16
|
47 }
|
Chris@16
|
48
|
Chris@16
|
49 BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
Chris@16
|
50
|
Chris@16
|
51 } // namespace boost
|
Chris@16
|
52
|
Chris@16
|
53 #include <boost/log/detail/footer.hpp>
|
Chris@16
|
54
|
Chris@16
|
55 #endif // BOOST_LOG_UTILITY_FUNCTIONAL_BIND_OUTPUT_HPP_INCLUDED_
|