stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file as_action.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains function object adapter for compatibility with Boost.Spirit actions interface requirements.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_AS_ACTION_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_AS_ACTION_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! Function object adapter for Boost.Spirit actions
|
||||
template< typename FunT >
|
||||
struct as_action_adapter
|
||||
{
|
||||
typedef typename FunT::result_type result_type;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(as_action_adapter(), {})
|
||||
explicit as_action_adapter(FunT const& fun) : m_fun(fun) {}
|
||||
|
||||
template< typename AttributeT, typename ContextT >
|
||||
result_type operator() (AttributeT const& attr, ContextT const& ctx, bool& pass) const
|
||||
{
|
||||
return m_fun(attr);
|
||||
}
|
||||
|
||||
private:
|
||||
FunT m_fun;
|
||||
};
|
||||
|
||||
template< typename FunT >
|
||||
BOOST_FORCEINLINE as_action_adapter< FunT > as_action(FunT const& fun)
|
||||
{
|
||||
return as_action_adapter< FunT >(fun);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_AS_ACTION_HPP_INCLUDED_
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file begins_with.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains a predicate for checking if the provided string begins with a substring.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_BEGINS_WITH_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_BEGINS_WITH_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! The \c begins_with functor
|
||||
struct begins_with_fun
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& left, U const& right) const
|
||||
{
|
||||
typedef typename T::const_iterator left_iterator;
|
||||
typedef typename U::const_iterator right_iterator;
|
||||
|
||||
left_iterator left_it = left.begin(), left_end = left.end();
|
||||
right_iterator right_it = right.begin(), right_end = right.end();
|
||||
for (; left_it != left_end && right_it != right_end; ++left_it, ++right_it)
|
||||
{
|
||||
if (*left_it != *right_it)
|
||||
break;
|
||||
}
|
||||
return right_it == right_end;
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_BEGINS_WITH_HPP_INCLUDED_
|
||||
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file bind.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains function object adapters.
|
||||
* This is a lightweight alternative to what Boost.Phoenix and Boost.Bind provides.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_BIND_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_BIND_HPP_INCLUDED_
|
||||
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
namespace aux {
|
||||
|
||||
template< typename T >
|
||||
struct make_arg_type
|
||||
{
|
||||
typedef T const& type;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
struct make_arg_type< T& >
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
//! First argument binder
|
||||
template< typename FunT, typename FirstArgT >
|
||||
struct binder1st :
|
||||
private FunT
|
||||
{
|
||||
typedef typename FunT::result_type result_type;
|
||||
|
||||
binder1st(FunT const& fun, typename aux::make_arg_type< FirstArgT >::type arg) : FunT(fun), m_arg(arg) {}
|
||||
|
||||
result_type operator() () const
|
||||
{
|
||||
return FunT::operator()(m_arg);
|
||||
}
|
||||
|
||||
template< typename T0 >
|
||||
result_type operator() (T0 const& arg0) const
|
||||
{
|
||||
return FunT::operator()(m_arg, arg0);
|
||||
}
|
||||
|
||||
template< typename T0, typename T1 >
|
||||
result_type operator() (T0 const& arg0, T1 const& arg1) const
|
||||
{
|
||||
return FunT::operator()(m_arg, arg0, arg1);
|
||||
}
|
||||
|
||||
private:
|
||||
FirstArgT m_arg;
|
||||
};
|
||||
|
||||
//! First argument binder
|
||||
template< typename FunT, typename FirstArgT >
|
||||
struct binder1st< FunT&, FirstArgT >
|
||||
{
|
||||
typedef typename remove_cv< FunT >::type::result_type result_type;
|
||||
|
||||
binder1st(FunT& fun, typename aux::make_arg_type< FirstArgT >::type arg) : m_fun(fun), m_arg(arg) {}
|
||||
|
||||
result_type operator() () const
|
||||
{
|
||||
return m_fun(m_arg);
|
||||
}
|
||||
|
||||
template< typename T0 >
|
||||
result_type operator() (T0 const& arg0) const
|
||||
{
|
||||
return m_fun(m_arg, arg0);
|
||||
}
|
||||
|
||||
template< typename T0, typename T1 >
|
||||
result_type operator() (T0 const& arg0, T1 const& arg1) const
|
||||
{
|
||||
return m_fun(m_arg, arg0, arg1);
|
||||
}
|
||||
|
||||
private:
|
||||
FunT& m_fun;
|
||||
FirstArgT m_arg;
|
||||
};
|
||||
|
||||
template< typename FunT, typename FirstArgT >
|
||||
BOOST_FORCEINLINE binder1st< FunT, FirstArgT > bind1st(FunT fun, FirstArgT const& arg)
|
||||
{
|
||||
return binder1st< FunT, FirstArgT >(fun, arg);
|
||||
}
|
||||
|
||||
template< typename FunT, typename FirstArgT >
|
||||
BOOST_FORCEINLINE binder1st< FunT, FirstArgT > bind1st(FunT fun, FirstArgT& arg)
|
||||
{
|
||||
return binder1st< FunT, FirstArgT >(fun, arg);
|
||||
}
|
||||
|
||||
//! Second argument binder
|
||||
template< typename FunT, typename SecondArgT >
|
||||
struct binder2nd :
|
||||
private FunT
|
||||
{
|
||||
typedef typename FunT::result_type result_type;
|
||||
|
||||
binder2nd(FunT const& fun, typename aux::make_arg_type< SecondArgT >::type arg) : FunT(fun), m_arg(arg) {}
|
||||
|
||||
template< typename T >
|
||||
result_type operator() (T const& arg) const
|
||||
{
|
||||
return FunT::operator()(arg, m_arg);
|
||||
}
|
||||
|
||||
template< typename T0, typename T1 >
|
||||
result_type operator() (T0 const& arg0, T1 const& arg1) const
|
||||
{
|
||||
return FunT::operator()(arg0, m_arg, arg1);
|
||||
}
|
||||
|
||||
private:
|
||||
SecondArgT m_arg;
|
||||
};
|
||||
|
||||
//! Second argument binder
|
||||
template< typename FunT, typename SecondArgT >
|
||||
struct binder2nd< FunT&, SecondArgT >
|
||||
{
|
||||
typedef typename remove_cv< FunT >::type::result_type result_type;
|
||||
|
||||
binder2nd(FunT& fun, typename aux::make_arg_type< SecondArgT >::type arg) : m_fun(fun), m_arg(arg) {}
|
||||
|
||||
template< typename T >
|
||||
result_type operator() (T const& arg) const
|
||||
{
|
||||
return m_fun(arg, m_arg);
|
||||
}
|
||||
|
||||
template< typename T0, typename T1 >
|
||||
result_type operator() (T0 const& arg0, T1 const& arg1) const
|
||||
{
|
||||
return m_fun(arg0, m_arg, arg1);
|
||||
}
|
||||
|
||||
private:
|
||||
FunT& m_fun;
|
||||
SecondArgT m_arg;
|
||||
};
|
||||
|
||||
template< typename FunT, typename SecondArgT >
|
||||
BOOST_FORCEINLINE binder2nd< FunT, SecondArgT > bind2nd(FunT fun, SecondArgT const& arg)
|
||||
{
|
||||
return binder2nd< FunT, SecondArgT >(fun, arg);
|
||||
}
|
||||
|
||||
template< typename FunT, typename SecondArgT >
|
||||
BOOST_FORCEINLINE binder2nd< FunT, SecondArgT > bind2nd(FunT fun, SecondArgT& arg)
|
||||
{
|
||||
return binder2nd< FunT, SecondArgT >(fun, arg);
|
||||
}
|
||||
|
||||
//! Third argument binder
|
||||
template< typename FunT, typename ThirdArgT >
|
||||
struct binder3rd :
|
||||
private FunT
|
||||
{
|
||||
typedef typename FunT::result_type result_type;
|
||||
|
||||
binder3rd(FunT const& fun, typename aux::make_arg_type< ThirdArgT >::type arg) : FunT(fun), m_arg(arg) {}
|
||||
|
||||
template< typename T0, typename T1 >
|
||||
result_type operator() (T0 const& arg0, T1 const& arg1) const
|
||||
{
|
||||
return FunT::operator()(arg0, arg1, m_arg);
|
||||
}
|
||||
|
||||
private:
|
||||
ThirdArgT m_arg;
|
||||
};
|
||||
|
||||
//! Third argument binder
|
||||
template< typename FunT, typename ThirdArgT >
|
||||
struct binder3rd< FunT&, ThirdArgT >
|
||||
{
|
||||
typedef typename remove_cv< FunT >::type::result_type result_type;
|
||||
|
||||
binder3rd(FunT& fun, typename aux::make_arg_type< ThirdArgT >::type arg) : m_fun(fun), m_arg(arg) {}
|
||||
|
||||
template< typename T0, typename T1 >
|
||||
result_type operator() (T0 const& arg0, T1 const& arg1) const
|
||||
{
|
||||
return m_fun(arg0, arg1, m_arg);
|
||||
}
|
||||
|
||||
private:
|
||||
FunT& m_fun;
|
||||
ThirdArgT m_arg;
|
||||
};
|
||||
|
||||
template< typename FunT, typename ThirdArgT >
|
||||
BOOST_FORCEINLINE binder3rd< FunT, ThirdArgT > bind3rd(FunT fun, ThirdArgT const& arg)
|
||||
{
|
||||
return binder3rd< FunT, ThirdArgT >(fun, arg);
|
||||
}
|
||||
|
||||
template< typename FunT, typename ThirdArgT >
|
||||
BOOST_FORCEINLINE binder3rd< FunT, ThirdArgT > bind3rd(FunT fun, ThirdArgT& arg)
|
||||
{
|
||||
return binder3rd< FunT, ThirdArgT >(fun, arg);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_BIND_HPP_INCLUDED_
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file bind_assign.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains a function object that assigns the received value to the bound object.
|
||||
* This is a lightweight alternative to what Boost.Phoenix and Boost.Lambda provides.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_BIND_ASSIGN_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_BIND_ASSIGN_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/utility/functional/bind.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! The function object that assigns its second operand to the first one
|
||||
struct assign_fun
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
template< typename LeftT, typename RightT >
|
||||
void operator() (LeftT& assignee, RightT const& val) const
|
||||
{
|
||||
assignee = val;
|
||||
}
|
||||
};
|
||||
|
||||
template< typename AssigneeT >
|
||||
BOOST_FORCEINLINE binder1st< assign_fun, AssigneeT& > bind_assign(AssigneeT& assignee)
|
||||
{
|
||||
return binder1st< assign_fun, AssigneeT& >(assign_fun(), assignee);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_BIND_ASSIGN_HPP_INCLUDED_
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file bind_output.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains a function object that puts the received value to the bound stream.
|
||||
* This is a lightweight alternative to what Boost.Phoenix and Boost.Lambda provides.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_BIND_OUTPUT_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_BIND_OUTPUT_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/utility/functional/bind.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! The function object that outputs its second operand to the first one
|
||||
struct output_fun
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
template< typename StreamT, typename T >
|
||||
void operator() (StreamT& strm, T const& val) const
|
||||
{
|
||||
strm << val;
|
||||
}
|
||||
};
|
||||
|
||||
template< typename StreamT >
|
||||
BOOST_FORCEINLINE binder1st< output_fun, StreamT& > bind_output(StreamT& strm)
|
||||
{
|
||||
return binder1st< output_fun, StreamT& >(output_fun(), strm);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_BIND_OUTPUT_HPP_INCLUDED_
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file bind_to_log.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 06.11.2012
|
||||
*
|
||||
* This header contains a function object that puts the received value to the bound stream using the \c to_log manipulator.
|
||||
* This is a lightweight alternative to what Boost.Phoenix and Boost.Lambda provides.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_BIND_TO_LOG_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_BIND_TO_LOG_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/utility/functional/bind.hpp>
|
||||
#include <boost/log/utility/manipulators/to_log.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! The function object that outputs its second operand to the first one
|
||||
template< typename TagT = void >
|
||||
struct to_log_fun
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
template< typename StreamT, typename T >
|
||||
void operator() (StreamT& strm, T const& val) const
|
||||
{
|
||||
strm << boost::log::to_log< TagT >(val);
|
||||
}
|
||||
};
|
||||
|
||||
//! The function object that outputs its second operand to the first one
|
||||
template< >
|
||||
struct to_log_fun< void >
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
template< typename StreamT, typename T >
|
||||
void operator() (StreamT& strm, T const& val) const
|
||||
{
|
||||
strm << boost::log::to_log(val);
|
||||
}
|
||||
};
|
||||
|
||||
template< typename StreamT >
|
||||
BOOST_FORCEINLINE binder1st< to_log_fun< >, StreamT& > bind_to_log(StreamT& strm)
|
||||
{
|
||||
return binder1st< to_log_fun< >, StreamT& >(to_log_fun< >(), strm);
|
||||
}
|
||||
|
||||
template< typename TagT, typename StreamT >
|
||||
BOOST_FORCEINLINE binder1st< to_log_fun< TagT >, StreamT& > bind_to_log(StreamT& strm)
|
||||
{
|
||||
return binder1st< to_log_fun< TagT >, StreamT& >(to_log_fun< TagT >(), strm);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_BIND_TO_LOG_HPP_INCLUDED_
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file contains.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains a predicate for checking if the provided string contains a substring.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_CONTAINS_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_CONTAINS_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! The \c contains functor
|
||||
struct contains_fun
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& left, U const& right) const
|
||||
{
|
||||
typedef typename T::const_iterator left_iterator;
|
||||
typedef typename U::const_iterator right_iterator;
|
||||
|
||||
typename U::size_type const right_size = right.size();
|
||||
if (left.size() >= right_size)
|
||||
{
|
||||
const left_iterator search_end = left.end() - right_size + 1;
|
||||
const right_iterator right_end = right.end();
|
||||
for (left_iterator it = left.begin(); it != search_end; ++it)
|
||||
{
|
||||
left_iterator left_it = it;
|
||||
right_iterator right_it = right.begin();
|
||||
for (; right_it != right_end; ++left_it, ++right_it)
|
||||
{
|
||||
if (*left_it != *right_it)
|
||||
break;
|
||||
}
|
||||
if (right_it == right_end)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_CONTAINS_HPP_INCLUDED_
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file ends_with.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains a predicate for checking if the provided string ends with a substring.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_ENDS_WITH_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_ENDS_WITH_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! The \c ends_with functor
|
||||
struct ends_with_fun
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& left, U const& right) const
|
||||
{
|
||||
typedef typename T::const_reverse_iterator left_iterator;
|
||||
typedef typename U::const_reverse_iterator right_iterator;
|
||||
|
||||
left_iterator left_it = left.rbegin(), left_end = left.rend();
|
||||
right_iterator right_it = right.rbegin(), right_end = right.rend();
|
||||
for (; left_it != left_end && right_it != right_end; ++left_it, ++right_it)
|
||||
{
|
||||
if (*left_it != *right_it)
|
||||
break;
|
||||
}
|
||||
return right_it == right_end;
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_ENDS_WITH_HPP_INCLUDED_
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file fun_ref.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains function object reference adapter. The adapter stores a reference to external
|
||||
* function object and forwards all calls to the referred function.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_FUN_REF_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_FUN_REF_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! Reference wrapper for function objects
|
||||
template< typename FunT >
|
||||
struct function_reference_wrapper
|
||||
{
|
||||
typedef typename FunT::result_type result_type;
|
||||
|
||||
explicit function_reference_wrapper(FunT& fun) : m_Fun(fun) {}
|
||||
|
||||
result_type operator() () const
|
||||
{
|
||||
return m_Fun();
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template< typename... ArgsT >
|
||||
result_type operator() (ArgsT const&... args) const
|
||||
{
|
||||
return m_Fun(args...);
|
||||
}
|
||||
#else
|
||||
template< typename T >
|
||||
result_type operator() (T const& arg) const
|
||||
{
|
||||
return m_Fun(arg);
|
||||
}
|
||||
|
||||
template< typename T1, typename T2 >
|
||||
result_type operator() (T1 const& arg1, T2 const& arg2) const
|
||||
{
|
||||
return m_Fun(arg1, arg2);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
FunT& m_Fun;
|
||||
};
|
||||
|
||||
template< typename FunT >
|
||||
BOOST_FORCEINLINE function_reference_wrapper< FunT > fun_ref(FunT& fun)
|
||||
{
|
||||
return function_reference_wrapper< FunT >(fun);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_FUN_REF_HPP_INCLUDED_
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file in_range.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains a predicate for checking if the provided value is within a half-open range.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_IN_RANGE_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_IN_RANGE_HPP_INCLUDED_
|
||||
|
||||
#include <utility>
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/utility/functional/logical.hpp> // make_common_integral_type
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! The in_range functor
|
||||
struct in_range_fun
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& value, std::pair< U, U > const& rng) const
|
||||
{
|
||||
return op(value, rng, typename mpl::and_< is_integral< T >, is_integral< U > >::type());
|
||||
}
|
||||
|
||||
private:
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& value, std::pair< U, U > const& rng, mpl::false_ const&)
|
||||
{
|
||||
return (value >= rng.first && value < rng.second);
|
||||
}
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& value, std::pair< U, U > const& rng, mpl::true_ const&)
|
||||
{
|
||||
typedef typename aux::make_common_integral_type< T, U >::type common_integral_type;
|
||||
return (static_cast< common_integral_type >(value) >= static_cast< common_integral_type >(rng.first))
|
||||
&& (static_cast< common_integral_type >(value) < static_cast< common_integral_type >(rng.second));
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_IN_RANGE_HPP_INCLUDED_
|
||||
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file logical.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains logical predicates for value comparison, analogous to \c std::less, \c std::greater
|
||||
* and others. The main difference from the standard equivalents is that the predicates defined in this
|
||||
* header are not templates and therefore do not require a fixed argument type. Furthermore, both arguments
|
||||
* may have different types, in which case the comparison is performed without type conversion.
|
||||
*
|
||||
* \note In case if arguments are integral, the conversion is performed according to the standard C++ rules
|
||||
* in order to avoid warnings from the compiler.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_LOGICAL_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_LOGICAL_HPP_INCLUDED_
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_unsigned.hpp>
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
namespace aux {
|
||||
|
||||
//! The trait creates a common integral type suitable for comparison. This is mostly to silence compiler warnings like 'signed/unsigned mismatch'.
|
||||
template< typename T, typename U, unsigned int TSizeV = sizeof(T), unsigned int USizeV = sizeof(U), bool TSmallerThanU = (sizeof(T) < sizeof(U)) >
|
||||
struct make_common_integral_type
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//! Specialization for case when \c T is smaller than \c U
|
||||
template< typename T, typename U, unsigned int TSizeV, unsigned int USizeV >
|
||||
struct make_common_integral_type< T, U, TSizeV, USizeV, true >
|
||||
{
|
||||
typedef U type;
|
||||
};
|
||||
|
||||
//! Specialization for the case when both types have the same size
|
||||
template< typename T, typename U, unsigned int SizeV >
|
||||
struct make_common_integral_type< T, U, SizeV, SizeV, false > :
|
||||
public mpl::if_<
|
||||
is_unsigned< T >,
|
||||
T,
|
||||
U
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
//! Equality predicate
|
||||
struct equal_to
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& left, U const& right) const
|
||||
{
|
||||
return op(left, right, typename mpl::and_< is_integral< T >, is_integral< U > >::type());
|
||||
}
|
||||
|
||||
private:
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::false_ const&)
|
||||
{
|
||||
return (left == right);
|
||||
}
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::true_ const&)
|
||||
{
|
||||
typedef typename aux::make_common_integral_type< T, U >::type common_integral_type;
|
||||
return static_cast< common_integral_type >(left) == static_cast< common_integral_type >(right);
|
||||
}
|
||||
};
|
||||
|
||||
//! Inequality predicate
|
||||
struct not_equal_to
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& left, U const& right) const
|
||||
{
|
||||
return op(left, right, typename mpl::and_< is_integral< T >, is_integral< U > >::type());
|
||||
}
|
||||
|
||||
private:
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::false_ const&)
|
||||
{
|
||||
return (left != right);
|
||||
}
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::true_ const&)
|
||||
{
|
||||
typedef typename aux::make_common_integral_type< T, U >::type common_integral_type;
|
||||
return static_cast< common_integral_type >(left) != static_cast< common_integral_type >(right);
|
||||
}
|
||||
};
|
||||
|
||||
//! Less predicate
|
||||
struct less
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& left, U const& right) const
|
||||
{
|
||||
return op(left, right, typename mpl::and_< is_integral< T >, is_integral< U > >::type());
|
||||
}
|
||||
|
||||
private:
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::false_ const&)
|
||||
{
|
||||
return (left < right);
|
||||
}
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::true_ const&)
|
||||
{
|
||||
typedef typename aux::make_common_integral_type< T, U >::type common_integral_type;
|
||||
return static_cast< common_integral_type >(left) < static_cast< common_integral_type >(right);
|
||||
}
|
||||
};
|
||||
|
||||
//! Greater predicate
|
||||
struct greater
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& left, U const& right) const
|
||||
{
|
||||
return op(left, right, typename mpl::and_< is_integral< T >, is_integral< U > >::type());
|
||||
}
|
||||
|
||||
private:
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::false_ const&)
|
||||
{
|
||||
return (left > right);
|
||||
}
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::true_ const&)
|
||||
{
|
||||
typedef typename aux::make_common_integral_type< T, U >::type common_integral_type;
|
||||
return static_cast< common_integral_type >(left) > static_cast< common_integral_type >(right);
|
||||
}
|
||||
};
|
||||
|
||||
//! Less or equal predicate
|
||||
struct less_equal
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& left, U const& right) const
|
||||
{
|
||||
return op(left, right, typename mpl::and_< is_integral< T >, is_integral< U > >::type());
|
||||
}
|
||||
|
||||
private:
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::false_ const&)
|
||||
{
|
||||
return (left <= right);
|
||||
}
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::true_ const&)
|
||||
{
|
||||
typedef typename aux::make_common_integral_type< T, U >::type common_integral_type;
|
||||
return static_cast< common_integral_type >(left) <= static_cast< common_integral_type >(right);
|
||||
}
|
||||
};
|
||||
|
||||
//! Greater or equal predicate
|
||||
struct greater_equal
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename T, typename U >
|
||||
bool operator() (T const& left, U const& right) const
|
||||
{
|
||||
return op(left, right, typename mpl::and_< is_integral< T >, is_integral< U > >::type());
|
||||
}
|
||||
|
||||
private:
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::false_ const&)
|
||||
{
|
||||
return (left >= right);
|
||||
}
|
||||
template< typename T, typename U >
|
||||
static bool op(T const& left, U const& right, mpl::true_ const&)
|
||||
{
|
||||
typedef typename aux::make_common_integral_type< T, U >::type common_integral_type;
|
||||
return static_cast< common_integral_type >(left) >= static_cast< common_integral_type >(right);
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_LOGICAL_HPP_INCLUDED_
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file matches.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains a predicate for checking if the provided string matches a regular expression.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_MATCHES_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_MATCHES_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
namespace aux {
|
||||
|
||||
//! The metafunction detects the matching expression kind and returns a tag that is used to specialize \c match_traits
|
||||
template< typename ExpressionT, typename = void >
|
||||
struct matching_expression_kind;
|
||||
|
||||
//! The matching function implementation
|
||||
template< typename ExpressionT, typename TagT = typename matching_expression_kind< ExpressionT >::type >
|
||||
struct match_traits;
|
||||
|
||||
} // namespace aux
|
||||
|
||||
//! The regex matching functor
|
||||
struct matches_fun
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< typename StringT, typename ExpressionT >
|
||||
bool operator() (StringT const& str, ExpressionT const& expr) const
|
||||
{
|
||||
typedef aux::match_traits< ExpressionT > impl;
|
||||
return impl::matches(str, expr);
|
||||
}
|
||||
template< typename StringT, typename ExpressionT, typename ArgT >
|
||||
bool operator() (StringT const& str, ExpressionT const& expr, ArgT const& arg) const
|
||||
{
|
||||
typedef aux::match_traits< ExpressionT > impl;
|
||||
return impl::matches(str, expr, arg);
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_MATCHES_HPP_INCLUDED_
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file nop.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 30.03.2008
|
||||
*
|
||||
* This header contains a function object that does nothing.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_NOP_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_NOP_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! The function object that does nothing
|
||||
struct nop
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
void operator() () const BOOST_NOEXCEPT {}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template< typename... ArgsT >
|
||||
void operator() (ArgsT const&...) const BOOST_NOEXCEPT {}
|
||||
#else
|
||||
template< typename T >
|
||||
void operator() (T const&) const BOOST_NOEXCEPT {}
|
||||
template< typename T1, typename T2 >
|
||||
void operator() (T1 const&, T2 const&) const BOOST_NOEXCEPT {}
|
||||
template< typename T1, typename T2, typename T3 >
|
||||
void operator() (T1 const&, T2 const&, T3 const&) const BOOST_NOEXCEPT {}
|
||||
#endif
|
||||
};
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_NOP_HPP_INCLUDED_
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2015.
|
||||
* 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)
|
||||
*/
|
||||
/*!
|
||||
* \file save_result.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 19.01.2013
|
||||
*
|
||||
* This header contains function object adapter that saves the result of the adopted function to an external variable.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_FUNCTIONAL_SAVE_RESULT_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_FUNCTIONAL_SAVE_RESULT_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
//! Function object wrapper for saving the adopted function object result
|
||||
template< typename FunT, typename AssigneeT >
|
||||
struct save_result_wrapper
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
save_result_wrapper(FunT fun, AssigneeT& assignee) : m_fun(fun), m_assignee(assignee) {}
|
||||
|
||||
template< typename ArgT >
|
||||
result_type operator() (ArgT const& arg) const
|
||||
{
|
||||
m_assignee = m_fun(arg);
|
||||
}
|
||||
|
||||
private:
|
||||
FunT m_fun;
|
||||
AssigneeT& m_assignee;
|
||||
};
|
||||
|
||||
template< typename FunT, typename AssigneeT >
|
||||
BOOST_FORCEINLINE save_result_wrapper< FunT, AssigneeT > save_result(FunT const& fun, AssigneeT& assignee)
|
||||
{
|
||||
return save_result_wrapper< FunT, AssigneeT >(fun, assignee);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_FUNCTIONAL_SAVE_RESULT_HPP_INCLUDED_
|
||||
Reference in New Issue
Block a user