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 relation/support/data_extractor.hpp
0010 /// \brief Data extraction functor.
0011 
0012 #ifndef BOOST_BIMAP_RELATION_SUPPORT_DATA_EXTRACTOR_HPP
0013 #define BOOST_BIMAP_RELATION_SUPPORT_DATA_EXTRACTOR_HPP
0014 
0015 #if defined(_MSC_VER)
0016 #pragma once
0017 #endif
0018 
0019 #include <boost/config.hpp>
0020 
0021 #include <boost/bimap/relation/detail/metadata_access_builder.hpp>
0022 
0023 /** \struct boost::bimaps::relation::support::data_extractor
0024 
0025 \brief Data extraction functor.
0026 
0027 \ingroup relation_group
0028                                                                     **/
0029 
0030 #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
0031 
0032 namespace boost {
0033 namespace bimaps {
0034 namespace relation {
0035 namespace support {
0036 
0037 template< class Tag, class Relation >
0038 struct data_extractor_implementation;
0039 
0040 template< class Relation >
0041 struct data_extractor_implementation< member_at::left, Relation >
0042 {
0043     typedef Relation argument_type;
0044     typedef BOOST_DEDUCED_TYPENAME Relation::left_value_type result_type;
0045 
0046     BOOST_DEDUCED_TYPENAME Relation::left_value_type const &
0047         operator()(Relation const & rel) const
0048     {
0049         return rel.left;
0050     }
0051 
0052     BOOST_DEDUCED_TYPENAME Relation::left_value_type &
0053         operator()(Relation       & rel) const
0054     {
0055         return rel.left;
0056     }
0057 };
0058 
0059 template< class Relation >
0060 struct data_extractor_implementation< member_at::right, Relation >
0061 {
0062     typedef Relation argument_type;
0063     typedef BOOST_DEDUCED_TYPENAME Relation::right_value_type result_type;
0064 
0065     BOOST_DEDUCED_TYPENAME Relation::right_value_type const & 
0066         operator()(Relation const & rel) const
0067     {
0068         return rel.right;
0069     }
0070 
0071     BOOST_DEDUCED_TYPENAME Relation::right_value_type & 
0072         operator()(Relation       & rel) const
0073     {
0074         return rel.right;
0075     }
0076 };
0077 
0078 template< class Tag, class Relation >
0079 struct data_extractor
0080 {
0081     typedef data_extractor_implementation
0082     <
0083         BOOST_DEDUCED_TYPENAME member_with_tag<Tag,Relation>::type,
0084         Relation
0085 
0086     > type;
0087 };
0088 
0089 template< class Relation >
0090 struct both_keys_extractor
0091 {
0092     typedef BOOST_DEDUCED_TYPENAME Relation::storage_base result_type;
0093 
0094      const result_type & operator()(const Relation & rel) const
0095     {
0096         return rel;
0097     }
0098 
0099     result_type & operator()( Relation & rel) const
0100     {
0101         return rel;
0102     }
0103 };
0104 
0105 } // namespace support
0106 } // namespace relation
0107 } // namespace bimaps
0108 } // namespace boost
0109 
0110 #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
0111 
0112 #endif // BOOST_BIMAP_RELATION_SUPPORT_DATA_EXTRACTOR_HPP
0113