/usr/include/boost
NameSizeModeActions
accumulators/-0755rm
algorithm/-0755rm
align/-0755rm
archive/-0755rm
asio/-0755rm
assert/-0755rm
assign/-0755rm
atomic/-0755rm
beast/-0755rm
bimap/-0755rm
bind/-0755rm
callable_traits/-0755rm
chrono/-0755rm
circular_buffer/-0755rm
compatibility/-0755rm
compute/-0755rm
concept/-0755rm
concept_check/-0755rm
config/-0755rm
container/-0755rm
container_hash/-0755rm
context/-0755rm
contract/-0755rm
convert/-0755rm
core/-0755rm
coroutine/-0755rm
coroutine2/-0755rm
date_time/-0755rm
detail/-0755rm
dll/-0755rm
dynamic_bitset/-0755rm
endian/-0755rm
exception/-0755rm
fiber/-0755rm
filesystem/-0755rm
flyweight/-0755rm
format/-0755rm
function/-0755rm
functional/-0755rm
function_types/-0755rm
fusion/-0755rm
geometry/-0755rm
gil/-0755rm
graph/-0755rm
hana/-0755rm
heap/-0755rm
histogram/-0755rm
hof/-0755rm
icl/-0755rm
integer/-0755rm
interprocess/-0755rm
intrusive/-0755rm
io/-0755rm
iostreams/-0755rm
iterator/-0755rm
lambda/-0755rm
lexical_cast/-0755rm
locale/-0755rm
local_function/-0755rm
lockfree/-0755rm
log/-0755rm
logic/-0755rm
math/-0755rm
metaparse/-0755rm
move/-0755rm
mp11/-0755rm
mpi/-0755rm
mpl/-0755rm
msm/-0755rm
multiprecision/-0755rm
multi_array/-0755rm
multi_index/-0755rm
nowide/-0755rm
numeric/-0755rm
optional/-0755rm
outcome/-0755rm
parameter/-0755rm
pending/-0755rm
phoenix/-0755rm
polygon/-0755rm
poly_collection/-0755rm
pool/-0755rm
predef/-0755rm
preprocessor/-0755rm
process/-0755rm
program_options/-0755rm
property_map/-0755rm
property_tree/-0755rm
proto/-0755rm
ptr_container/-0755rm
python/-0755rm
qvm/-0755rm
random/-0755rm
range/-0755rm
ratio/-0755rm
regex/-0755rm
safe_numerics/-0755rm
serialization/-0755rm
signals2/-0755rm
smart_ptr/-0755rm
sort/-0755rm
spirit/-0755rm
stacktrace/-0755rm
statechart/-0755rm
static_string/-0755rm
stl_interfaces/-0755rm
system/-0755rm
test/-0755rm
thread/-0755rm
timer/-0755rm
tti/-0755rm
tuple/-0755rm
typeof/-0755rm
type_erasure/-0755rm
type_index/-0755rm
type_traits/-0755rm
units/-0755rm
unordered/-0755rm
utility/-0755rm
uuid/-0755rm
variant/-0755rm
variant2/-0755rm
vmd/-0755rm
wave/-0755rm
winapi/-0755rm
xpressive/-0755rm
yap/-0755rm
align.hpp6330644editdlrm
aligned_storage.hpp6530644editdlrm
any.hpp94720644editdlrm
array.hpp158270644editdlrm
asio.hpp74720644editdlrm
assert.hpp26250644editdlrm
assign.hpp5920644editdlrm
atomic.hpp7540644editdlrm
beast.hpp5910644editdlrm
bimap.hpp3870644editdlrm
bind.hpp18090644editdlrm
blank.hpp19850644editdlrm
blank_fwd.hpp6180644editdlrm
callable_traits.hpp21380644editdlrm
call_traits.hpp6330644editdlrm
cast.hpp5840644editdlrm
cerrno.hpp41870644editdlrm
checked_delete.hpp4140644editdlrm
chrono.hpp7060644editdlrm
circular_buffer.hpp19460644editdlrm
circular_buffer_fwd.hpp11370644editdlrm
compressed_pair.hpp6530644editdlrm
compute.hpp15230644editdlrm
concept_archetype.hpp237250644editdlrm
concept_check.hpp319770644editdlrm
config.hpp22160644editdlrm
contract.hpp18420644editdlrm
contract_macro.hpp564970644editdlrm
convert.hpp74020644editdlrm
crc.hpp948830644editdlrm
cregex.hpp7210644editdlrm
cstdfloat.hpp26110644editdlrm
cstdint.hpp184970644editdlrm
cstdlib.hpp17390644editdlrm
current_function.hpp16810644editdlrm
cxx11_char_types.hpp41600644editdlrm
date_time.hpp5400644editdlrm
dll.hpp7120644editdlrm
dynamic_bitset.hpp5600644editdlrm
dynamic_bitset_fwd.hpp6750644editdlrm
enable_shared_from_this.hpp5250644editdlrm
endian.hpp3640644editdlrm
exception_ptr.hpp3960644editdlrm
filesystem.hpp8620644editdlrm
flyweight.hpp6040644editdlrm
foreach.hpp455510644editdlrm
foreach_fwd.hpp17020644editdlrm
format.hpp21790644editdlrm
function.hpp25240644editdlrm
functional.hpp201240644editdlrm
function_equal.hpp7910644editdlrm
function_output_iterator.hpp6300644editdlrm
generator_iterator.hpp20280644editdlrm
geometry.hpp7040644editdlrm
get_pointer.hpp22880644editdlrm
gil.hpp16970644editdlrm
hana.hpp68070644editdlrm
histogram.hpp13120644editdlrm
hof.hpp20090644editdlrm
implicit_cast.hpp8100644editdlrm
indirect_reference.hpp10360644editdlrm
integer.hpp115930644editdlrm
integer_fwd.hpp51810644editdlrm
integer_traits.hpp83190644editdlrm
intrusive_ptr.hpp4810644editdlrm
io_fwd.hpp18790644editdlrm
is_placeholder.hpp6340644editdlrm
iterator.hpp4590644editdlrm
iterator_adaptors.hpp4660644editdlrm
lexical_cast.hpp32750644editdlrm
limits.hpp61560644editdlrm
locale.hpp8870644editdlrm
local_function.hpp188580644editdlrm
make_default.hpp15100644editdlrm
make_shared.hpp4640644editdlrm
make_unique.hpp2930644editdlrm
math_fwd.hpp9750644editdlrm
memory_order.hpp24570644editdlrm
mem_fn.hpp5960644editdlrm
metaparse.hpp52810644editdlrm
mp11.hpp6410644editdlrm
mpi.hpp11010644editdlrm
multi_array.hpp180210644editdlrm
multi_index_container.hpp449830644editdlrm
multi_index_container_fwd.hpp37760644editdlrm
next_prior.hpp51270644editdlrm
noncopyable.hpp4020644editdlrm
nondet_random.hpp5320644editdlrm
none.hpp16090644editdlrm
none_t.hpp9530644editdlrm
non_type.hpp6190644editdlrm
operators.hpp365740644editdlrm
operators_v1.hpp377350644editdlrm
optional.hpp5280644editdlrm
outcome.hpp16990644editdlrm
parameter.hpp10820644editdlrm
phoenix.hpp4760644editdlrm
pointee.hpp18070644editdlrm
pointer_cast.hpp36880644editdlrm
pointer_to_other.hpp11970644editdlrm
polymorphic_cast.hpp52820644editdlrm
polymorphic_pointer_cast.hpp28290644editdlrm
predef.h6350644editdlrm
preprocessor.hpp4870644editdlrm
process.hpp13660644editdlrm
program_options.hpp8200644editdlrm
progress.hpp57340644editdlrm
python.hpp29500644editdlrm
random.hpp38540644editdlrm
range.hpp6030644editdlrm
ratio.hpp3490644editdlrm
rational.hpp397200644editdlrm
ref.hpp3700644editdlrm
regex.h21740644editdlrm
regex.hpp8230644editdlrm
regex_fwd.hpp6930644editdlrm
scoped_array.hpp5060644editdlrm
scoped_ptr.hpp4970644editdlrm
scope_exit.hpp547450644editdlrm
shared_array.hpp5360644editdlrm
shared_container_iterator.hpp21540644editdlrm
shared_ptr.hpp5250644editdlrm
signals2.hpp7520644editdlrm
smart_ptr.hpp7800644editdlrm
spirit.hpp11330644editdlrm
stacktrace.hpp4990644editdlrm
static_assert.hpp72130644editdlrm
static_string.hpp4230644editdlrm
swap.hpp3740644editdlrm
thread.hpp8390644editdlrm
throw_exception.hpp43280644editdlrm
timer.hpp27810644editdlrm
tokenizer.hpp27830644editdlrm
token_functions.hpp193490644editdlrm
token_iterator.hpp38100644editdlrm
type.hpp4810644editdlrm
type_index.hpp107570644editdlrm
type_traits.hpp74310644editdlrm
unordered_map.hpp5680644editdlrm
unordered_set.hpp5680644editdlrm
utility.hpp8800644editdlrm
variant.hpp8830644editdlrm
version.hpp11170644editdlrm
visit_each.hpp6900644editdlrm
wave.hpp9440644editdlrm
weak_ptr.hpp4620644editdlrm
Edit: /usr/include/boost/multi_array.hpp (18021B)
// Copyright 2002 The Trustees of Indiana University. // Copyright 2018 Glen Joseph Fernandes // (glenjofe@gmail.com) // Use, modification and distribution is subject to 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) // Boost.MultiArray Library // Authors: Ronald Garcia // Jeremy Siek // Andrew Lumsdaine // See http://www.boost.org/libs/multi_array for documentation. #ifndef BOOST_MULTI_ARRAY_HPP #define BOOST_MULTI_ARRAY_HPP // // multi_array.hpp - contains the multi_array class template // declaration and definition // #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wshadow" #endif #include "boost/multi_array/base.hpp" #include "boost/multi_array/collection_concept.hpp" #include "boost/multi_array/copy_array.hpp" #include "boost/multi_array/iterator.hpp" #include "boost/multi_array/subarray.hpp" #include "boost/multi_array/multi_array_ref.hpp" #include "boost/multi_array/algorithm.hpp" #include "boost/core/alloc_construct.hpp" #include "boost/core/empty_value.hpp" #include "boost/array.hpp" #include "boost/mpl/if.hpp" #include "boost/type_traits.hpp" #include #include #include #include #include namespace boost { namespace detail { namespace multi_array { struct populate_index_ranges { multi_array_types::index_range // RG: underscore on extent_ to stifle strange MSVC warning. operator()(multi_array_types::index base, multi_array_types::size_type extent_) { return multi_array_types::index_range(base,base+extent_); } }; #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING // // Compilers that don't support partial ordering may need help to // disambiguate multi_array's templated constructors. Even vc6/7 are // capable of some limited SFINAE, so we take the most-general version // out of the overload set with disable_multi_array_impl. // template char is_multi_array_impl_help(const_multi_array_view&); template char is_multi_array_impl_help(const_sub_array&); template char is_multi_array_impl_help(const_multi_array_ref&); char ( &is_multi_array_impl_help(...) )[2]; template struct is_multi_array_impl { static T x; BOOST_STATIC_CONSTANT(bool, value = sizeof((is_multi_array_impl_help)(x)) == 1); typedef mpl::bool_ type; }; template struct disable_multi_array_impl_impl { typedef int type; }; template <> struct disable_multi_array_impl_impl { // forming a pointer to a reference triggers SFINAE typedef int& type; }; template struct disable_multi_array_impl : disable_multi_array_impl_impl::value> { }; template <> struct disable_multi_array_impl { typedef int type; }; #endif } //namespace multi_array } // namespace detail template class multi_array : public multi_array_ref, private boost::empty_value { typedef boost::empty_value alloc_base; typedef multi_array_ref super_type; public: typedef typename super_type::value_type value_type; typedef typename super_type::reference reference; typedef typename super_type::const_reference const_reference; typedef typename super_type::iterator iterator; typedef typename super_type::const_iterator const_iterator; typedef typename super_type::reverse_iterator reverse_iterator; typedef typename super_type::const_reverse_iterator const_reverse_iterator; typedef typename super_type::element element; typedef typename super_type::size_type size_type; typedef typename super_type::difference_type difference_type; typedef typename super_type::index index; typedef typename super_type::extent_range extent_range; template struct const_array_view { typedef boost::detail::multi_array::const_multi_array_view type; }; template struct array_view { typedef boost::detail::multi_array::multi_array_view type; }; explicit multi_array(const Allocator& alloc = Allocator()) : super_type((T*)initial_base_,c_storage_order(), /*index_bases=*/0, /*extents=*/0), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); } template explicit multi_array( ExtentList const& extents, const Allocator& alloc = Allocator() #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING , typename mpl::if_< detail::multi_array::is_multi_array_impl, int&,int>::type* = 0 #endif ) : super_type((T*)initial_base_,extents), alloc_base(boost::empty_init_t(),alloc) { boost::function_requires< detail::multi_array::CollectionConcept >(); allocate_space(); } template explicit multi_array(ExtentList const& extents, const general_storage_order& so) : super_type((T*)initial_base_,extents,so), alloc_base(boost::empty_init_t()) { boost::function_requires< detail::multi_array::CollectionConcept >(); allocate_space(); } template explicit multi_array(ExtentList const& extents, const general_storage_order& so, Allocator const& alloc) : super_type((T*)initial_base_,extents,so), alloc_base(boost::empty_init_t(),alloc) { boost::function_requires< detail::multi_array::CollectionConcept >(); allocate_space(); } explicit multi_array(const detail::multi_array ::extent_gen& ranges, const Allocator& alloc = Allocator()) : super_type((T*)initial_base_,ranges), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); } explicit multi_array(const detail::multi_array ::extent_gen& ranges, const general_storage_order& so) : super_type((T*)initial_base_,ranges,so), alloc_base(boost::empty_init_t()) { allocate_space(); } explicit multi_array(const detail::multi_array ::extent_gen& ranges, const general_storage_order& so, Allocator const& alloc) : super_type((T*)initial_base_,ranges,so), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); } multi_array(const multi_array& rhs) : super_type(rhs), alloc_base(static_cast(rhs)) { allocate_space(); boost::detail::multi_array::copy_n(rhs.base_,rhs.num_elements(),base_); } // // A multi_array is constructible from any multi_array_ref, subarray, or // array_view object. The following constructors ensure that. // // Due to limited support for partial template ordering, // MSVC 6&7 confuse the following with the most basic ExtentList // constructor. #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template multi_array(const const_multi_array_ref& rhs, const general_storage_order& so = c_storage_order(), const Allocator& alloc = Allocator()) : super_type(0,so,rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); // Warning! storage order may change, hence the following copy technique. std::copy(rhs.begin(),rhs.end(),this->begin()); } template multi_array(const detail::multi_array:: const_sub_array& rhs, const general_storage_order& so = c_storage_order(), const Allocator& alloc = Allocator()) : super_type(0,so,rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } template multi_array(const detail::multi_array:: const_multi_array_view& rhs, const general_storage_order& so = c_storage_order(), const Allocator& alloc = Allocator()) : super_type(0,so,rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } #else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING // More limited support for MSVC multi_array(const const_multi_array_ref& rhs, const Allocator& alloc = Allocator()) : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); // Warning! storage order may change, hence the following copy technique. std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const const_multi_array_ref& rhs, const general_storage_order& so, const Allocator& alloc = Allocator()) : super_type(0,so,rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); // Warning! storage order may change, hence the following copy technique. std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const detail::multi_array:: const_sub_array& rhs, const Allocator& alloc = Allocator()) : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const detail::multi_array:: const_sub_array& rhs, const general_storage_order& so, const Allocator& alloc = Allocator()) : super_type(0,so,rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const detail::multi_array:: const_multi_array_view& rhs, const Allocator& alloc = Allocator()) : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const detail::multi_array:: const_multi_array_view& rhs, const general_storage_order& so, const Allocator& alloc = Allocator()) : super_type(0,so,rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } #endif // !BOOST_NO_FUNCTION_TEMPLATE_ORDERING // Thes constructors are necessary because of more exact template matches. multi_array(const multi_array_ref& rhs, const Allocator& alloc = Allocator()) : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); // Warning! storage order may change, hence the following copy technique. std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const multi_array_ref& rhs, const general_storage_order& so, const Allocator& alloc = Allocator()) : super_type(0,so,rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); // Warning! storage order may change, hence the following copy technique. std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const detail::multi_array:: sub_array& rhs, const Allocator& alloc = Allocator()) : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const detail::multi_array:: sub_array& rhs, const general_storage_order& so, const Allocator& alloc = Allocator()) : super_type(0,so,rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const detail::multi_array:: multi_array_view& rhs, const Allocator& alloc = Allocator()) : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } multi_array(const detail::multi_array:: multi_array_view& rhs, const general_storage_order& so, const Allocator& alloc = Allocator()) : super_type(0,so,rhs.index_bases(),rhs.shape()), alloc_base(boost::empty_init_t(),alloc) { allocate_space(); std::copy(rhs.begin(),rhs.end(),this->begin()); } // Since assignment is a deep copy, multi_array_ref // contains all the necessary code. template multi_array& operator=(const ConstMultiArray& other) { super_type::operator=(other); return *this; } multi_array& operator=(const multi_array& other) { if (&other != this) { super_type::operator=(other); } return *this; } template multi_array& resize(const ExtentList& extents) { boost::function_requires< detail::multi_array::CollectionConcept >(); typedef detail::multi_array::extent_gen gen_type; gen_type ranges; for (int i=0; i != NumDims; ++i) { typedef typename gen_type::range range_type; ranges.ranges_[i] = range_type(0,extents[i]); } return this->resize(ranges); } multi_array& resize(const detail::multi_array ::extent_gen& ranges) { // build a multi_array with the specs given multi_array new_array(ranges,this->storage_order(),allocator()); // build a view of tmp with the minimum extents // Get the minimum extents of the arrays. boost::array min_extents; const size_type& (*min)(const size_type&, const size_type&) = std::min; std::transform(new_array.extent_list_.begin(),new_array.extent_list_.end(), this->extent_list_.begin(), min_extents.begin(), min); // typedef boost::array index_list; // Build index_gen objects to create views with the same shape // these need to be separate to handle non-zero index bases typedef detail::multi_array::index_gen index_gen; index_gen old_idxes; index_gen new_idxes; std::transform(new_array.index_base_list_.begin(), new_array.index_base_list_.end(), min_extents.begin(),new_idxes.ranges_.begin(), detail::multi_array::populate_index_ranges()); std::transform(this->index_base_list_.begin(), this->index_base_list_.end(), min_extents.begin(),old_idxes.ranges_.begin(), detail::multi_array::populate_index_ranges()); // Build same-shape views of the two arrays typename multi_array::BOOST_NESTED_TEMPLATE array_view::type view_old = (*this)[old_idxes]; typename multi_array::BOOST_NESTED_TEMPLATE array_view::type view_new = new_array[new_idxes]; // Set the right portion of the new array view_new = view_old; using std::swap; // Swap the internals of these arrays. swap(this->super_type::base_,new_array.super_type::base_); swap(this->allocator(),new_array.allocator()); swap(this->storage_,new_array.storage_); swap(this->extent_list_,new_array.extent_list_); swap(this->stride_list_,new_array.stride_list_); swap(this->index_base_list_,new_array.index_base_list_); swap(this->origin_offset_,new_array.origin_offset_); swap(this->directional_offset_,new_array.directional_offset_); swap(this->num_elements_,new_array.num_elements_); swap(this->base_,new_array.base_); swap(this->allocated_elements_,new_array.allocated_elements_); return *this; } ~multi_array() { deallocate_space(); } private: friend inline bool operator==(const multi_array& a, const multi_array& b) { return a.base() == b.base(); } friend inline bool operator!=(const multi_array& a, const multi_array& b) { return !(a == b); } const super_type& base() const { return *this; } const Allocator& allocator() const { return alloc_base::get(); } Allocator& allocator() { return alloc_base::get(); } void allocate_space() { base_ = allocator().allocate(this->num_elements()); this->set_base_ptr(base_); allocated_elements_ = this->num_elements(); boost::alloc_construct_n(allocator(),base_,allocated_elements_); } void deallocate_space() { if(base_) { boost::alloc_destroy_n(allocator(),base_,allocated_elements_); allocator().deallocate(base_,allocated_elements_); } } typedef boost::array size_list; typedef boost::array index_list; T* base_; size_type allocated_elements_; enum {initial_base_ = 0}; }; } // namespace boost #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406) # pragma GCC diagnostic pop #endif #endif