File indexing completed on 2025-01-18 09:29:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_BIMAP_RELATION_DETAIL_MUTANT_HPP
0013 #define BOOST_BIMAP_RELATION_DETAIL_MUTANT_HPP
0014
0015 #if defined(_MSC_VER)
0016 #pragma once
0017 #endif
0018
0019 #include <boost/config.hpp>
0020
0021 #include <boost/bimap/detail/debug/static_error.hpp>
0022 #include <boost/mpl/contains.hpp>
0023 #include <boost/mpl/assert.hpp>
0024 #include <boost/static_assert.hpp>
0025 #include <boost/type_traits/is_const.hpp>
0026 #include <boost/utility/addressof.hpp>
0027 #include <boost/mpl/not.hpp>
0028 #include <boost/core/enable_if.hpp>
0029
0030 namespace boost {
0031 namespace bimaps {
0032 namespace relation {
0033
0034
0035
0036 namespace detail {
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 template< class View, class Type >
0050 BOOST_DEDUCED_TYPENAME enable_if< mpl::not_< is_const< Type > >,
0051
0052 View&
0053
0054 >::type mutate( Type & m )
0055 {
0056 BOOST_MPL_ASSERT((
0057 ::boost::mpl::contains<BOOST_DEDUCED_TYPENAME Type::mutant_views,View>
0058 ));
0059 return *reinterpret_cast< View* >(boost::addressof(m));
0060 }
0061
0062 template< class View, class Type >
0063 BOOST_DEDUCED_TYPENAME enable_if< is_const< Type >,
0064
0065 const View&
0066
0067 >::type mutate( Type & m )
0068 {
0069 BOOST_MPL_ASSERT((
0070 ::boost::mpl::contains<BOOST_DEDUCED_TYPENAME Type::mutant_views,View>
0071 ));
0072 return *reinterpret_cast< const View* >(boost::addressof(m));
0073 }
0074
0075
0076
0077 }
0078 }
0079 }
0080 }
0081
0082 #endif
0083