Chris@16: // Boost.Bimap Chris@16: // Chris@16: // Copyright (c) 2006-2007 Matias Capeletto Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: /// \file relation/support/get.hpp Chris@16: /// \brief get(r) function Chris@16: Chris@16: #ifndef BOOST_BIMAP_RELATION_SUPPORT_GET_HPP Chris@16: #define BOOST_BIMAP_RELATION_SUPPORT_GET_HPP Chris@16: Chris@101: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES Chris@16: Chris@16: Chris@16: namespace boost { Chris@16: namespace bimaps { Chris@16: namespace relation { Chris@16: namespace support { Chris@16: Chris@16: /** \brief Gets a pair view of the relation. Chris@16: Chris@16: \ingroup relation_group Chris@16: **/ Chris@16: Chris@16: template< class Tag, class SymmetricType > Chris@16: BOOST_DEDUCED_TYPENAME result_of::get::type Chris@16: get( SymmetricType & ); Chris@16: Chris@16: } // namespace support Chris@16: } // namespace relation Chris@16: } // namespace bimaps Chris@16: } // namespace boost Chris@16: Chris@16: #endif // BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES Chris@16: Chris@16: Chris@16: Chris@16: #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES Chris@16: Chris@16: namespace boost { Chris@16: namespace bimaps { Chris@16: namespace relation { Chris@16: namespace support { Chris@16: Chris@16: // Since it is very error-prone to directly write the hole bunch Chris@16: // of relation accesor. They are buil from litle macro blocks that Chris@16: // are both more readable, leading to self docummenting code and a Chris@16: // lot more easier to understand and mantain. Chris@16: // It is very important to note that the three building blocks have Chris@16: // to laid in the same namespace in order to work. There is also Chris@16: // important to keep them in order. Chris@16: // The forward declaration are not necesary but they help a lot to Chris@16: // the reader, as they undercover what is the signature of the Chris@16: // result code. Chris@16: // In the end, it is not quicker to do it in this way because you Chris@16: // write a lot. But this code has no complexity at all and almost Chris@16: // every word writed is for documentation. Chris@16: Chris@16: // Result of Chris@16: // ------------------------------------------------------------------------- Chris@16: /* Chris@16: namespace result_of { Chris@16: Chris@16: template< class Tag, class Relation > Chris@16: struct get; Chris@16: { Chris@16: typedef -unspecified- type; Chris@16: }; Chris@16: Chris@16: } // namespace result_of Chris@16: Chris@16: */ Chris@16: Chris@16: BOOST_BIMAP_SYMMETRIC_ACCESS_RESULT_OF_BUILDER Chris@16: ( Chris@16: get, Chris@16: value_type_of Chris@16: ) Chris@16: Chris@16: Chris@16: Chris@16: // Implementation Chris@16: // ------------------------------------------------------------------------- Chris@16: Chris@16: BOOST_BIMAP_SYMMETRIC_ACCESS_IMPLEMENTATION_BUILDER Chris@16: ( Chris@16: get, Chris@16: SymmetricType, Chris@16: st, Chris@16: return st.get_left(), Chris@16: return st.get_right() Chris@16: ) Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: template< class SymmetricType > Chris@16: BOOST_DEDUCED_TYPENAME result_of::get< Chris@16: ::boost::bimaps::relation::member_at::info, SymmetricType >::type Chris@16: get(::boost::bimaps::relation::member_at::info, SymmetricType & rel) Chris@16: { Chris@16: return rel.info; Chris@16: } Chris@16: Chris@16: } // namespace detail Chris@16: Chris@16: // Interface Chris@16: //---------------------------------------------------------------------------- Chris@16: Chris@16: BOOST_BIMAP_SYMMETRIC_ACCESS_INTERFACE_BUILDER Chris@16: ( Chris@16: get Chris@16: ) Chris@16: Chris@16: Chris@16: } // namespace support Chris@16: } // namespace relation Chris@16: } // namespace bimaps Chris@16: } // namespace boost Chris@16: Chris@16: #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES Chris@16: Chris@16: #endif // BOOST_BIMAP_RELATION_SUPPORT_GET_HPP Chris@16: