/usr/include/boost/bimap/detail/set_view_base.hpp is in libboost1.55-dev 1.55.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | // Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
/// \file detail/set_view_base.hpp
/// \brief Helper base for the construction of the bimap views types.
#ifndef BOOST_BIMAP_DETAIL_SET_VIEW_BASE_HPP
#define BOOST_BIMAP_DETAIL_SET_VIEW_BASE_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/relation/member_at.hpp>
#include <boost/bimap/relation/support/data_extractor.hpp>
#include <boost/bimap/detail/modifier_adaptor.hpp>
#include <boost/bimap/detail/set_view_iterator.hpp>
#include <boost/bimap/relation/support/get_pair_functor.hpp>
#include <boost/bimap/relation/detail/to_mutable_relation_functor.hpp>
#include <boost/bimap/relation/mutant_relation.hpp>
#include <boost/bimap/container_adaptor/support/iterator_facade_converters.hpp>
namespace boost {
namespace bimaps {
namespace detail {
template< class Key, class Value, class KeyToBase >
class set_view_key_to_base
{
public:
const Key operator()( const Value & v ) const
{
return keyToBase( v );
}
private:
KeyToBase keyToBase;
};
template< class MutantRelationStorage, class KeyToBase >
class set_view_key_to_base<MutantRelationStorage,MutantRelationStorage,KeyToBase>
{
typedef BOOST_DEDUCED_TYPENAME MutantRelationStorage::non_mutable_storage non_mutable_storage;
public:
const MutantRelationStorage & operator()( const non_mutable_storage & k ) const
{
return ::boost::bimaps::relation::detail::mutate<MutantRelationStorage>(k);
}
const MutantRelationStorage & operator()( const MutantRelationStorage & k ) const
{
return k;
}
};
// The next macro can be converted in a metafunctor to gain code robustness.
/*===========================================================================*/
#define BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR( \
CONTAINER_ADAPTOR, CORE_INDEX, OTHER_ITER, CONST_OTHER_ITER \
) \
::boost::bimaps::container_adaptor::CONTAINER_ADAPTOR \
< \
CORE_INDEX, \
::boost::bimaps::detail:: \
set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator >, \
::boost::bimaps::detail:: \
const_set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator >, \
::boost::bimaps::detail:: \
set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::OTHER_ITER >, \
::boost::bimaps::detail:: \
const_set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::CONST_OTHER_ITER >, \
::boost::bimaps::container_adaptor::support::iterator_facade_to_base \
< \
::boost::bimaps::detail:: set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator>, \
::boost::bimaps::detail::const_set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator> \
\
>, \
::boost::mpl::na, \
::boost::mpl::na, \
::boost::bimaps::relation::detail:: \
get_mutable_relation_functor< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >, \
::boost::bimaps::relation::support:: \
get_above_view_functor< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >, \
::boost::bimaps::detail::set_view_key_to_base< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::key_type, \
BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type, \
BOOST_DEDUCED_TYPENAME CORE_INDEX::key_from_value \
> \
>
/*===========================================================================*/
/*===========================================================================*/
#define BOOST_BIMAP_SEQUENCED_SET_VIEW_CONTAINER_ADAPTOR( \
CONTAINER_ADAPTOR, CORE_INDEX, OTHER_ITER, CONST_OTHER_ITER \
) \
::boost::bimaps::container_adaptor::CONTAINER_ADAPTOR \
< \
CORE_INDEX, \
::boost::bimaps::detail:: \
set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator >, \
::boost::bimaps::detail:: \
const_set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator >, \
::boost::bimaps::detail:: \
set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::OTHER_ITER >, \
::boost::bimaps::detail:: \
const_set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::CONST_OTHER_ITER >, \
::boost::bimaps::container_adaptor::support::iterator_facade_to_base \
< \
::boost::bimaps::detail:: set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator>, \
::boost::bimaps::detail::const_set_view_iterator< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator> \
\
>, \
::boost::mpl::na, \
::boost::mpl::na, \
::boost::bimaps::relation::detail:: \
get_mutable_relation_functor< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >, \
::boost::bimaps::relation::support:: \
get_above_view_functor< \
BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type > \
>
/*===========================================================================*/
#if defined(BOOST_MSVC)
/*===========================================================================*/
#define BOOST_BIMAP_SET_VIEW_BASE_FRIEND(TYPE,INDEX_TYPE) \
typedef ::boost::bimaps::detail::set_view_base< \
TYPE< INDEX_TYPE >, INDEX_TYPE > template_class_friend; \
friend class template_class_friend;
/*===========================================================================*/
#else
/*===========================================================================*/
#define BOOST_BIMAP_SET_VIEW_BASE_FRIEND(TYPE,INDEX_TYPE) \
friend class ::boost::bimaps::detail::set_view_base< \
TYPE< INDEX_TYPE >, INDEX_TYPE >;
/*===========================================================================*/
#endif
/// \brief Common base for set views.
template< class Derived, class Index >
class set_view_base
{
typedef ::boost::bimaps::container_adaptor::support::
iterator_facade_to_base
<
::boost::bimaps::detail::
set_view_iterator<BOOST_DEDUCED_TYPENAME Index:: iterator>,
::boost::bimaps::detail::
const_set_view_iterator<BOOST_DEDUCED_TYPENAME Index::const_iterator>
> iterator_to_base_;
typedef BOOST_DEDUCED_TYPENAME Index::value_type::left_value_type left_type_;
typedef BOOST_DEDUCED_TYPENAME Index::value_type::right_value_type right_type_;
typedef BOOST_DEDUCED_TYPENAME Index::value_type value_type_;
typedef ::boost::bimaps::detail::
set_view_iterator<BOOST_DEDUCED_TYPENAME Index::iterator> iterator_;
public:
bool replace(iterator_ position,
const value_type_ & x)
{
return derived().base().replace(
derived().template functor<iterator_to_base_>()(position),x
);
}
template< class CompatibleLeftType >
bool replace_left(iterator_ position,
const CompatibleLeftType & l)
{
return derived().base().replace(
derived().template functor<iterator_to_base_>()(position),
::boost::bimaps::relation::detail::copy_with_left_replaced(*position,l)
);
}
template< class CompatibleRightType >
bool replace_right(iterator_ position,
const CompatibleRightType & r)
{
return derived().base().replace(
derived().template functor<iterator_to_base_>()(position),
::boost::bimaps::relation::detail::copy_with_right_replaced(*position,r)
);
}
/* This function may be provided in the future
template< class Modifier >
bool modify(iterator_ position,
Modifier mod)
{
return derived().base().modify(
derived().template functor<iterator_to_base_>()(position),
::boost::bimaps::detail::relation_modifier_adaptor
<
Modifier,
BOOST_DEDUCED_TYPENAME Index::value_type,
BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
data_extractor
<
::boost::bimaps::relation::member_at::left,
BOOST_DEDUCED_TYPENAME Index::value_type
>::type,
BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
data_extractor
<
::boost::bimaps::relation::member_at::right,
BOOST_DEDUCED_TYPENAME Index::value_type
>::type
>(mod)
);
}
*/
/*
template< class Modifier >
bool modify_left(iterator_ position, Modifier mod)
{
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
data_extractor
<
BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::member_at::right,
BOOST_DEDUCED_TYPENAME Index::value_type
>::type left_data_extractor_;
return derived().base().modify(
derived().template functor<iterator_to_base_>()(position),
// this may be replaced later by
// ::boost::bind( mod, ::boost::bind(data_extractor_(),_1) )
::boost::bimaps::detail::unary_modifier_adaptor
<
Modifier,
BOOST_DEDUCED_TYPENAME Index::value_type,
left_data_extractor_
>(mod)
);
}
template< class Modifier >
bool modify_right(iterator_ position, Modifier mod)
{
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
data_extractor
<
BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::member_at::right,
BOOST_DEDUCED_TYPENAME Index::value_type
>::type right_data_extractor_;
return derived().base().modify(
derived().template functor<iterator_to_base_>()(position),
// this may be replaced later by
// ::boost::bind( mod, ::boost::bind(data_extractor_(),_1) )
::boost::bimaps::detail::unary_modifier_adaptor
<
Modifier,
BOOST_DEDUCED_TYPENAME Index::value_type,
right_data_extractor_
>(mod)
);
}
*/
protected:
typedef set_view_base set_view_base_;
private:
// Curiously Recurring Template interface.
Derived& derived()
{
return *static_cast<Derived*>(this);
}
Derived const& derived() const
{
return *static_cast<Derived const*>(this);
}
};
} // namespace detail
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_DETAIL_SET_VIEW_BASE_HPP
|