Chris@102: /////////////////////////////////////////////////////////////////////////////// Chris@102: // Chris@102: // (C) Copyright Ion Gaztanaga 2014-2014. Distributed under the Boost Chris@102: // Software License, Version 1.0. (See accompanying file Chris@102: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@102: // Chris@102: // See http://www.boost.org/libs/container for documentation. Chris@102: // Chris@102: /////////////////////////////////////////////////////////////////////////////// Chris@102: Chris@102: #ifndef BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP Chris@102: #define BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP Chris@102: Chris@102: #ifndef BOOST_CONFIG_HPP Chris@102: # include Chris@102: #endif Chris@102: Chris@102: #if defined(BOOST_HAS_PRAGMA_ONCE) Chris@102: # pragma once Chris@102: #endif Chris@102: Chris@102: namespace boost { Chris@102: namespace container { Chris@102: Chris@102: template Chris@102: class equal_to_value Chris@102: { Chris@102: typedef typename Allocator::value_type value_type; Chris@102: const value_type &t_; Chris@102: Chris@102: public: Chris@102: explicit equal_to_value(const value_type &t) Chris@102: : t_(t) Chris@102: {} Chris@102: Chris@102: bool operator()(const value_type &t)const Chris@102: { return t_ == t; } Chris@102: }; Chris@102: Chris@102: template Chris@102: struct value_to_node_compare Chris@102: : Pred Chris@102: { Chris@102: typedef Pred predicate_type; Chris@102: typedef Node node_type; Chris@102: Chris@102: value_to_node_compare() Chris@102: : Pred() Chris@102: {} Chris@102: Chris@102: explicit value_to_node_compare(Pred pred) Chris@102: : Pred(pred) Chris@102: {} Chris@102: Chris@102: bool operator()(const Node &a, const Node &b) const Chris@102: { return static_cast(*this)(a.m_data, b.m_data); } Chris@102: Chris@102: bool operator()(const Node &a) const Chris@102: { return static_cast(*this)(a.m_data); } Chris@102: Chris@102: bool operator()(const Node &a, const Node &b) Chris@102: { return static_cast(*this)(a.m_data, b.m_data); } Chris@102: Chris@102: bool operator()(const Node &a) Chris@102: { return static_cast(*this)(a.m_data); } Chris@102: Chris@102: predicate_type & predicate() { return static_cast(*this); } Chris@102: const predicate_type & predicate() const { return static_cast(*this); } Chris@102: }; Chris@102: Chris@102: } //namespace container { Chris@102: } //namespace boost { Chris@102: Chris@102: #endif //BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP