/usr/include/boost/serialization/vector.hpp is in libboost1.46-dev 1.46.1-7ubuntu3.
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 | #ifndef BOOST_SERIALIZATION_VECTOR_HPP
#define BOOST_SERIALIZATION_VECTOR_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// vector.hpp: serialization for stl vector templates
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// fast array serialization (C) Copyright 2005 Matthias Troyer
// 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)
// See http://www.boost.org for updates, documentation, and revision history.
#include <vector>
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/type_traits/is_arithmetic.hpp>
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/collections_load_imp.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/detail/get_data.hpp>
#include <boost/mpl/bool.hpp>
// default is being compatible with version 1.34.1 files, not 1.35 files
#ifndef BOOST_SERIALIZATION_VECTOR_VERSIONED
#define BOOST_SERIALIZATION_VECTOR_VERSIONED(V) (V==4 || V==5)
#endif
namespace boost {
namespace serialization {
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// vector< T >
// the default versions
template<class Archive, class U, class Allocator>
inline void save(
Archive & ar,
const std::vector<U, Allocator> &t,
const unsigned int /* file_version */,
mpl::false_
){
boost::serialization::stl::save_collection<Archive, STD::vector<U, Allocator> >(
ar, t
);
}
template<class Archive, class U, class Allocator>
inline void load(
Archive & ar,
std::vector<U, Allocator> &t,
const unsigned int /* file_version */,
mpl::false_
){
boost::serialization::stl::load_collection<
Archive,
std::vector<U, Allocator>,
boost::serialization::stl::archive_input_seq<
Archive, STD::vector<U, Allocator>
>,
boost::serialization::stl::reserve_imp<STD::vector<U, Allocator> >
>(ar, t);
}
// the optimized versions
template<class Archive, class U, class Allocator>
inline void save(
Archive & ar,
const std::vector<U, Allocator> &t,
const unsigned int /* file_version */,
mpl::true_
){
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
if (!t.empty())
ar << make_array(detail::get_data(t),t.size());
}
template<class Archive, class U, class Allocator>
inline void load(
Archive & ar,
std::vector<U, Allocator> &t,
const unsigned int /* file_version */,
mpl::true_
){
collection_size_type count(t.size());
ar >> BOOST_SERIALIZATION_NVP(count);
t.resize(count);
unsigned int item_version=0;
if(BOOST_SERIALIZATION_VECTOR_VERSIONED(ar.get_library_version())) {
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
if (!t.empty())
ar >> make_array(detail::get_data(t),t.size());
}
// dispatch to either default or optimized versions
template<class Archive, class U, class Allocator>
inline void save(
Archive & ar,
const std::vector<U, Allocator> &t,
const unsigned int file_version
){
typedef BOOST_DEDUCED_TYPENAME
boost::serialization::use_array_optimization<Archive>::template apply<
BOOST_DEDUCED_TYPENAME remove_const<U>::type
>::type use_optimized;
save(ar,t,file_version, use_optimized());
}
template<class Archive, class U, class Allocator>
inline void load(
Archive & ar,
std::vector<U, Allocator> &t,
const unsigned int file_version
){
#ifdef BOOST_SERIALIZATION_VECTOR_135_HPP
if (ar.get_library_version()==boost::archive::library_version_type(5))
{
load(ar,t,file_version, boost::is_arithmetic<U>());
return;
}
#endif
typedef BOOST_DEDUCED_TYPENAME
boost::serialization::use_array_optimization<Archive>::template apply<
BOOST_DEDUCED_TYPENAME remove_const<U>::type
>::type use_optimized;
load(ar,t,file_version, use_optimized());
}
// split non-intrusive serialization function member into separate
// non intrusive save/load member functions
template<class Archive, class U, class Allocator>
inline void serialize(
Archive & ar,
std::vector<U, Allocator> & t,
const unsigned int file_version
){
boost::serialization::split_free(ar, t, file_version);
}
#if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// vector<bool>
template<class Archive, class Allocator>
inline void save(
Archive & ar,
const std::vector<bool, Allocator> &t,
const unsigned int /* file_version */
){
// record number of elements
collection_size_type count (t.size());
ar << BOOST_SERIALIZATION_NVP(count);
std::vector<bool>::const_iterator it = t.begin();
while(count-- > 0){
bool tb = *it++;
ar << boost::serialization::make_nvp("item", tb);
}
}
template<class Archive, class Allocator>
inline void load(
Archive & ar,
std::vector<bool, Allocator> &t,
const unsigned int /* file_version */
){
// retrieve number of elements
collection_size_type count;
ar >> BOOST_SERIALIZATION_NVP(count);
t.clear();
while(count-- > 0){
bool i;
ar >> boost::serialization::make_nvp("item", i);
t.push_back(i);
}
}
// split non-intrusive serialization function member into separate
// non intrusive save/load member functions
template<class Archive, class Allocator>
inline void serialize(
Archive & ar,
std::vector<bool, Allocator> & t,
const unsigned int file_version
){
boost::serialization::split_free(ar, t, file_version);
}
#endif // BOOST_WORKAROUND
} // serialization
} // namespace boost
#include <boost/serialization/collection_traits.hpp>
BOOST_SERIALIZATION_COLLECTION_TRAITS(std::vector)
#endif // BOOST_SERIALIZATION_VECTOR_HPP
|