Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:38

0001 // Boost.Bimap
0002 //
0003 // Copyright (c) 2006-2007 Matias Capeletto
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 // (See accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 /// \file detail/modifier_adaptor.hpp
0010 /// \brief A binary to unary functor relation modifier adaptor.
0011 
0012 #ifndef BOOST_BIMAP_DETAIL_MODIFIER_ADAPTOR_HPP
0013 #define BOOST_BIMAP_DETAIL_MODIFIER_ADAPTOR_HPP
0014 
0015 #if defined(_MSC_VER)
0016 #pragma once
0017 #endif
0018 
0019 #include <boost/config.hpp>
0020 
0021 namespace boost {
0022 namespace bimaps {
0023 namespace detail {
0024 
0025 /// \brief A binary to unary functor relation modifier adaptor.
0026 
0027 template
0028 <
0029     class Modifier,
0030     class NewArgument,
0031     class FirstExtractor,
0032     class SecondExtractor 
0033 >
0034 struct relation_modifier_adaptor :
0035     Modifier,
0036     FirstExtractor,
0037     SecondExtractor
0038 {
0039     typedef NewArgument argument_type;
0040     typedef void result_type;
0041 
0042     relation_modifier_adaptor( const Modifier & m ) : Modifier(m) {}
0043     relation_modifier_adaptor( const Modifier & m,
0044                                const FirstExtractor & fe,
0045                                const SecondExtractor & se ) :
0046         Modifier(m), FirstExtractor(fe), SecondExtractor(se) {}
0047 
0048     void operator()( NewArgument & x ) const
0049     {
0050         Modifier::operator()(
0051             FirstExtractor ::operator()( x ),
0052             SecondExtractor::operator()( x )
0053         );
0054     }
0055 };
0056 
0057 /// \brief A simple unary modifier adaptor.
0058 // This modifier is equivalent to bind( Modifier, bind( Extractor, _1 ) )
0059 // It may be a good idea to start using Boost.Bind instead of it.
0060 
0061 template
0062 <
0063     class Modifier,
0064     class NewArgument,
0065     class Extractor
0066 >
0067 struct unary_modifier_adaptor :
0068     Modifier,
0069     Extractor
0070 {
0071     typedef NewArgument argument_type;
0072     typedef void result_type;
0073 
0074     unary_modifier_adaptor( const Modifier & m ) : Modifier(m) {}
0075     unary_modifier_adaptor( const Modifier & m,
0076                             const Extractor & fe) :
0077         Modifier(m), Extractor(fe) {}
0078 
0079     void operator()( NewArgument & x ) const
0080     {
0081         Modifier::operator()( Extractor::operator()( x ) );
0082     }
0083 };
0084 
0085 
0086 } // namespace detail
0087 } // namespace bimap
0088 } // namespace boost
0089 
0090 
0091 #endif // BOOST_BIMAP_DETAIL_MODIFIER_ADAPTOR_HPP