Compare commits

..

23 Commits

Author SHA1 Message Date
Peter Dimov acbd1f88f9 Merge branch 'develop' 2017-01-07 15:51:21 +02:00
Peter Dimov aba55e6180 Remove --depth 1 from git submodule update 2017-01-07 14:36:45 +02:00
Robert Ramey 51b1df323b fix warning 2016-12-26 20:47:48 -08:00
Robert Ramey 247f223d82 attempt to address compilation errors win MNGW tests 2016-12-17 13:46:36 -08:00
Robert Ramey 619250c93a merged in correction breaking backward compatibility 2016-12-05 14:16:54 -08:00
Robert Ramey 66ccdc00f1 adjustments to get test_dll_exported to pass on MSVC platforms 2016-11-30 15:31:02 -08:00
Robert Ramey a8bbbea4e7 latest attempt to permit test_dll_exported to compile under MSVC compilers 2016-11-30 12:31:24 -08:00
Robert Ramey c3552e1d03 remove visibility attributes from exported/imported class function implementations per microsoft instructions 2016-11-29 08:08:12 -08:00
Robert Ramey c518afa8ad remove visibility attributes from exported/imported class function implementations per microsoft instructions 2016-11-28 20:51:51 -08:00
Robert Ramey 29593efac2 corrected pragmas used to track import/export attributes 2016-11-27 20:42:40 -08:00
Robert Ramey 5986edcfd3 Add pragma messages to display import/exports at compile time 2016-11-25 21:59:57 -08:00
Robert Ramey d558b6da91 adjustments to make test_dll_simple pass 2016-11-25 13:39:18 -08:00
Robert Ramey 4d11c54e60 adjustments shorten appveyor load
make A_DLL symbol unique to avoid confusion and conflict
2016-11-24 12:30:31 -08:00
Robert Ramey 1fda900179 correct path in bootstrap and b2 2016-11-23 13:19:12 -08:00
Robert Ramey 0c7141fb78 add appveyor.yml to get testing of windows version 2016-11-23 10:52:22 -08:00
Robert Ramey 6e24d1eb48 addressing mdvc failure on test_dll_exported 2016-11-22 09:52:58 -08:00
Robert Ramey fceaca0a34 attempt to correct failure of test_dll_export on microsoft platforms 2016-11-21 15:30:11 -08:00
Robert Ramey b98b458293 Role back changes in valarray due to failures on microsoft platform
Adjust visibility for singleton in the hope of passing mngw tests.
2016-11-20 13:22:47 -08:00
Robert Ramey 26366fecb5 attempt to fix linking problems with singleton module 2016-11-18 09:33:32 -08:00
Robert Ramey 058f1fed43 fix utf8 convert selection - looks like msvc <codecvt> doesn't properly work with uff8_codecvt
Adjust val array to see if it can be made to acceptable to intel compiler
2016-11-17 23:22:50 -08:00
Robert Ramey 6b33d1cd4e refactor various tests related to arrays and lists 2016-11-14 23:39:14 -08:00
Robert Ramey ec74c5a143 Merge branch 'develop' of https://github.com/boostorg/serialization into develop 2016-11-14 14:30:43 -08:00
Robert Ramey 58b4f73c70 corrections to test invocation for lists 2016-11-14 14:30:01 -08:00
39 changed files with 544 additions and 524 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ install:
- git submodule init libs/utility
- git submodule init libs/variant
- git submodule init tools/build
- git submodule update --depth 1
- git submodule update
- cp -r $TRAVIS_BUILD_DIR/* libs/serialization
- ./bootstrap.sh
- ./b2 headers
+17 -2
View File
@@ -112,6 +112,7 @@ set(Boost_DETAILED_FAILURE_MSG true)
set(Boost_FOUND true)
find_package(Boost REQUIRED COMPONENTS system filesystem)
include(CheckIncludeFileCXX)
message(STATUS "Boost_FOUND is ${Boost_FOUND}")
@@ -320,6 +321,14 @@ archive_test(test_shared_ptr_multi_base)
archive_test(test_shared_ptr_132)
archive_test(test_simple_class A)
archive_test(test_simple_class_ptr A)
CHECK_INCLUDE_FILE_CXX(slist SLIST_FOUND)
if(SLIST_FOUND)
message(STATUS "slist header found")
archive_test(test_slist A)
archive_test(test_slist_ptr A)
else()
message(STATUS "slist header NOT found")
endif()
archive_test(test_stack A)
archive_test(test_split)
archive_test(test_tracking)
@@ -333,12 +342,18 @@ archive_test(test_set_boost_unordered A)
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_set_unordered A)
else()
archive_test(test_set_hashed A)
CHECK_INCLUDE_FILE_CXX(hash_set HASH_SET_FOUND)
if(HASH_SET_FOUND)
archive_test(test_set_hashed A)
endif()
endif()
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_map_unordered A)
else()
archive_test(test_map_hashed A)
CHECK_INCLUDE_FILE_CXX(hash_map HASH_MAP_FOUND)
if(HASH_MAP_FOUND)
archive_test(test_map_hashed A)
endif()
endif()
polymorphic_archive_test(test_polymorphic test_polymorphic_A A)
+65
View File
@@ -0,0 +1,65 @@
# Copyright 2016 Peter Dimov
# Copyright 2016 Robert Ramey
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- develop
# - master
install:
- cd ..
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule init libs/align
- git submodule init libs/array
- git submodule init libs/assert
- git submodule init libs/bind
- git submodule init libs/compatibility
- git submodule init libs/concept_check
- git submodule init libs/config
- git submodule init libs/container
- git submodule init libs/core
- git submodule init libs/detail
- git submodule init libs/filesystem
- git submodule init libs/function
- git submodule init libs/functional
- git submodule init libs/integer
- git submodule init libs/intrusive
- git submodule init libs/io
- git submodule init libs/iterator
- git submodule init libs/lexical_cast
- git submodule init libs/math
- git submodule init libs/move
- git submodule init libs/mpl
- git submodule init libs/numeric/conversion
- git submodule init libs/optional
- git submodule init libs/predef
- git submodule init libs/preprocessor
- git submodule init libs/range
- git submodule init libs/smart_ptr
- git submodule init libs/spirit
- git submodule init libs/static_assert
- git submodule init libs/system
- git submodule init libs/throw_exception
- git submodule init libs/tuple
- git submodule init libs/type_index
- git submodule init libs/type_traits
- git submodule init libs/unordered
- git submodule init libs/utility
- git submodule init libs/variant
- git submodule init tools/build
- git submodule update
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\serialization
- bootstrap
- b2 headers
build: off
test_script:
- b2 libs/serialization/test toolset=msvc-12.0 link=static,shared
@@ -50,7 +50,7 @@ namespace std{
//#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/codecvt_null.hpp>
@@ -45,7 +45,7 @@ namespace std{
//#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/codecvt_null.hpp>
+1 -2
View File
@@ -89,8 +89,7 @@ protected:
// leaving the archive in an undetermined state
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(class_id_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(class_id_optional_type & /* t */){}
void load_override(class_id_optional_type & /* t */){}
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(object_id_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
+1 -1
View File
@@ -77,10 +77,10 @@ namespace std{
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/singleton.hpp>
#include <boost/serialization/wrapper.hpp>
#include <boost/serialization/array_wrapper.hpp>
// the following is need only for dynamic cast of polymorphic pointers
#include <boost/archive/archive_exception.hpp>
+2 -1
View File
@@ -56,8 +56,9 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/singleton.hpp>
#include <boost/archive/archive_exception.hpp>
@@ -9,11 +9,14 @@
#include <boost/config.hpp>
// std::codecvt_utf8 doesn't seem to work for msvc
// versions prior to MSVC 14.0
#ifdef BOOST_NO_STD_WSTREAMBUF
#error "wide char i/o not supported on this platform"
#endif
#if defined(_MSC_VER) && _MSC_VER < 1900 \
|| defined( BOOST_NO_CXX11_HDR_CODECVT )
// std::codecvt_utf8 doesn't seem to work for any versions of msvc
#if defined(_MSC_VER) || defined(BOOST_NO_CXX11_HDR_CODECVT)
// use boost's utf8 codecvt facet
#include <boost/archive/detail/decl.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace archive { namespace detail {
@@ -26,9 +29,11 @@
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#else
// use the standard vendor supplied facet
#include <codecvt>
namespace boost { namespace archive { namespace detail {
typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
} } }
#endif // BOOST_NO_CXX11_HDR_CODECVT
#endif
#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
@@ -26,6 +26,7 @@ namespace std{
using ::mbstate_t;
} // namespace std
#endif
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
+13 -138
View File
@@ -6,135 +6,30 @@
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//#include <iostream>
// for serialization of <array>. If <array> not supported by the standard
// library - this file becomes empty. This is to avoid breaking backward
// compatibiliy for applications which used this header to support
// serialization of native arrays. Code to serialize native arrays is
// now always include by default. RR
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
#include <iostream>
#include <cstddef> // std::size_t
namespace std{
using ::size_t;
} // namespace std
#endif
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/wrapper.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/mpl/always.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/static_assert.hpp>
namespace boost { namespace serialization {
// traits to specify whether to use an optimized array serialization
template <class Archive>
struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {};
template<class T>
class array_wrapper :
public wrapper_traits<const array_wrapper< T > >
{
private:
array_wrapper & operator=(const array_wrapper & rhs);
// note: I would like to make the copy constructor private but this breaks
// make_array. So I make make_array a friend
template<class Tx, class S>
friend const boost::serialization::array_wrapper<Tx> make_array(Tx * t, S s);
public:
array_wrapper(const array_wrapper & rhs) :
m_t(rhs.m_t),
m_element_count(rhs.m_element_count)
{}
public:
array_wrapper(T * t, std::size_t s) :
m_t(t),
m_element_count(s)
{}
// default implementation
template<class Archive>
void serialize_optimized(Archive &ar, const unsigned int, mpl::false_ ) const
{
// default implemention does the loop
std::size_t c = count();
T * t = address();
while(0 < c--)
ar & boost::serialization::make_nvp("item", *t++);
}
// optimized implementation
template<class Archive>
void serialize_optimized(Archive &ar, const unsigned int version, mpl::true_ )
{
boost::serialization::split_member(ar, *this, version);
}
// default implementation
template<class Archive>
void save(Archive &ar, const unsigned int version) const
{
ar.save_array(*this,version);
}
// default implementation
template<class Archive>
void load(Archive &ar, const unsigned int version)
{
ar.load_array(*this,version);
}
// default implementation
template<class Archive>
void serialize(Archive &ar, const unsigned int version)
{
typedef typename
boost::serialization::use_array_optimization<Archive>::template apply<
typename remove_const< T >::type
>::type use_optimized;
serialize_optimized(ar,version,use_optimized());
}
T * address() const
{
return m_t;
}
std::size_t count() const
{
return m_element_count;
}
private:
T * const m_t;
const std::size_t m_element_count;
};
template<class T, class S>
inline
const array_wrapper< T > make_array(T* t, S s){
const array_wrapper< T > a(t, s);
return a;
}
} } // end namespace boost::serialization
// I can't figure out why BOOST_NO_CXX11_HDR_ARRAY
// has been set for clang-11. So just make sure
// it's reset now. Needs further research!!!
#if defined(_LIBCPP_VERSION)
#undef BOOST_NO_CXX11_HDR_ARRAY
#endif
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
#include <boost/serialization/nvp.hpp>
namespace boost { namespace serialization {
// implement serialization for std::array
template <class Archive, class T, std::size_t N>
void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */)
{
@@ -145,27 +40,7 @@ void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */
}
} } // end namespace boost::serialization
#endif
#include <boost/array.hpp>
namespace boost { namespace serialization {
// implement serialization for boost::array
template <class Archive, class T, std::size_t N>
void serialize(Archive& ar, boost::array<T,N>& a, const unsigned int /* version */)
{
ar & boost::serialization::make_nvp("elems", a.elems);
}
} } // end namespace boost::serialization
#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) \
namespace boost { namespace serialization { \
template <> struct use_array_optimization<Archive> { \
template <class ValueType> \
struct apply : boost::mpl::apply1<Archive::use_array_optimization \
, typename boost::remove_const<ValueType>::type \
>::type {}; \
}; }}
#endif // BOOST_NO_CXX11_HDR_ARRAY
#endif //BOOST_SERIALIZATION_ARRAY_HPP
@@ -0,0 +1,37 @@
#ifndef BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
#define BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
// 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)
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
} // namespace std
#endif
#include <boost/mpl/always.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace serialization {
template <class Archive>
struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {};
} } // end namespace boost::serialization
#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) \
namespace boost { namespace serialization { \
template <> struct use_array_optimization<Archive> { \
template <class ValueType> \
struct apply : boost::mpl::apply1<Archive::use_array_optimization \
, typename boost::remove_const<ValueType>::type \
>::type {}; \
}; }}
#endif //BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
@@ -0,0 +1,121 @@
#ifndef BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
#define BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
// 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)
//#include <iostream>
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
} // namespace std
#endif
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/wrapper.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/array_optimization.hpp>
#include <boost/mpl/always.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace serialization {
template<class T>
class array_wrapper :
public wrapper_traits<const array_wrapper< T > >
{
private:
array_wrapper & operator=(const array_wrapper & rhs);
// note: I would like to make the copy constructor private but this breaks
// make_array. So I make make_array a friend
template<class Tx, class S>
friend const boost::serialization::array_wrapper<Tx> make_array(Tx * t, S s);
public:
array_wrapper(const array_wrapper & rhs) :
m_t(rhs.m_t),
m_element_count(rhs.m_element_count)
{}
public:
array_wrapper(T * t, std::size_t s) :
m_t(t),
m_element_count(s)
{}
// default implementation
template<class Archive>
void serialize_optimized(Archive &ar, const unsigned int, mpl::false_ ) const
{
// default implemention does the loop
std::size_t c = count();
T * t = address();
while(0 < c--)
ar & boost::serialization::make_nvp("item", *t++);
}
// optimized implementation
template<class Archive>
void serialize_optimized(Archive &ar, const unsigned int version, mpl::true_ )
{
boost::serialization::split_member(ar, *this, version);
}
// default implementation
template<class Archive>
void save(Archive &ar, const unsigned int version) const
{
ar.save_array(*this,version);
}
// default implementation
template<class Archive>
void load(Archive &ar, const unsigned int version)
{
ar.load_array(*this,version);
}
// default implementation
template<class Archive>
void serialize(Archive &ar, const unsigned int version)
{
typedef typename
boost::serialization::use_array_optimization<Archive>::template apply<
typename remove_const< T >::type
>::type use_optimized;
serialize_optimized(ar,version,use_optimized());
}
T * address() const
{
return m_t;
}
std::size_t count() const
{
return m_element_count;
}
private:
T * const m_t;
const std::size_t m_element_count;
};
template<class T, class S>
inline
const array_wrapper< T > make_array(T* t, S s){
const array_wrapper< T > a(t, s);
return a;
}
} } // end namespace boost::serialization
#endif //BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
@@ -0,0 +1,33 @@
#ifndef BOOST_SERIALIZATION_ARRAY_HPP
#define BOOST_SERIALIZATION_ARRAY_HPP
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
// 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)
//#include <iostream>
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
} // namespace std
#endif
#include <boost/serialization/nvp.hpp>
#include <boost/array.hpp>
namespace boost { namespace serialization {
// implement serialization for boost::array
template <class Archive, class T, std::size_t N>
void serialize(Archive& ar, boost::array<T,N>& a, const unsigned int /* version */)
{
ar & boost::serialization::make_nvp("elems", a.elems);
}
} } // end namespace boost::serialization
#endif //BOOST_SERIALIZATION_ARRAY_HPP
@@ -1,59 +0,0 @@
// (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.
#ifndef BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
#define BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
#define STD _STLP_STD
#else
#define STD std
#endif
#include <vector>
#include <valarray>
namespace boost {
namespace serialization {
namespace detail {
template <class T, class Allocator>
T* get_data(STD::vector<T,Allocator>& v)
{
return v.empty() ? 0 : &(v[0]);
}
template <class T, class Allocator>
T* get_data(STD::vector<T,Allocator> const & v)
{
return get_data(const_cast<STD::vector<T,Allocator>&>(v));
}
template <class T>
T* get_data(STD::valarray<T>& v)
{
return v.size()==0 ? 0 : &(v[0]);
}
template <class T>
const T* get_data(STD::valarray<T> const& v)
{
return get_data(const_cast<STD::valarray<T>&>(v));
}
} // detail
} // serialization
} // boost
#undef STD
#endif // BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
+12 -4
View File
@@ -85,11 +85,19 @@ class BOOST_SYMBOL_VISIBLE singleton_module :
public boost::noncopyable
{
private:
static bool & get_lock();
BOOST_SERIALIZATION_DECL static bool & get_lock();
public:
BOOST_SERIALIZATION_DECL static void lock();
BOOST_SERIALIZATION_DECL static void unlock();
BOOST_SERIALIZATION_DECL static bool is_locked();
static void lock(){
get_lock() = true;
}
static void unlock(){
get_lock() = false;
}
static bool is_locked(){
return get_lock();
}
};
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+8 -4
View File
@@ -18,10 +18,12 @@
#include <valarray>
#include <boost/config.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/collection_size_type.hpp>
#include <boost/serialization/detail/get_data.hpp>
#include <boost/serialization/array_wrapper.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
@@ -42,12 +44,13 @@ void save( Archive & ar, const STD::valarray<U> &t, const unsigned int /*file_ve
{
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
if (t.size())
if (t.size()){
// explict template arguments to pass intel C++ compiler
ar << serialization::make_array<const U, collection_size_type>(
static_cast<const U *>(&t[0]),
count
);
}
}
template<class Archive, class U>
@@ -56,12 +59,13 @@ void load( Archive & ar, STD::valarray<U> &t, const unsigned int /*file_version
collection_size_type count;
ar >> BOOST_SERIALIZATION_NVP(count);
t.resize(count);
if (t.size())
if (t.size()){
// explict template arguments to pass intel C++ compiler
ar >> serialization::make_array<U, collection_size_type>(
static_cast<U *>(&t[0]),
count
);
}
}
// split non-intrusive serialization function member into separate
+1 -2
View File
@@ -31,8 +31,7 @@
#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/serialization/array_wrapper.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/mpl/if.hpp>
+4 -2
View File
@@ -17,20 +17,22 @@
namespace boost {
namespace serialization {
bool & singleton_module::get_lock(){
BOOST_SERIALIZATION_DECL bool & singleton_module::get_lock(){
static bool lock = false;
return lock;
}
#if 0
BOOST_SERIALIZATION_DECL void singleton_module::lock(){
get_lock() = true;
}
BOOST_SERIALIZATION_DECL void singleton_module::unlock(){
get_lock() = false;
}
BOOST_SERIALIZATION_DECL bool singleton_module::is_locked() {
BOOST_SERIALIZATION_DECL bool singleton_module::is_locked(){
return get_lock();
}
#endif
} // namespace serialization
} // namespace boost
+18 -15
View File
@@ -4,20 +4,23 @@
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
#ifdef BOOST_NO_STD_WSTREAMBUF
#error "wide char i/o not supported on this platform"
#else
// #ifdef BOOST_NO_CXX11_HDR_CODECVT
#if 1
# define BOOST_ARCHIVE_SOURCE
#include <boost/archive/detail/decl.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace archive { namespace detail {
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
#define BOOST_UTF8_END_NAMESPACE }}}
#include <boost/detail/utf8_codecvt_facet.ipp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#endif // BOOST_NO_CXX11_HDR_CODECVT
#endif // BOOST_NO_STD_WSTREAMBUF
#endif
// std::codecvt_utf8 doesn't seem to work for any versions of msvc
#if defined(_MSC_VER) \
|| defined( BOOST_NO_CXX11_HDR_CODECVT )
// include boost implementation of utf8 codecvt facet
# define BOOST_ARCHIVE_SOURCE
#include <boost/archive/detail/decl.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace archive { namespace detail {
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
#define BOOST_UTF8_END_NAMESPACE }}}
#include <boost/detail/utf8_codecvt_facet.ipp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#endif
+1 -1
View File
@@ -76,8 +76,8 @@ A::operator std::size_t () const {
#if defined(_MSC_VER)
#pragma warning(push) // Save warning settings.
#pragma warning(disable : 4244) // Disable possible loss of data warning
#endif
#endif
A::A() :
b(true),
#ifndef BOOST_NO_INT64_T
+12 -75
View File
@@ -20,98 +20,37 @@
#include <cstddef> // size_t
#include <string>
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
}
#endif
#include <boost/detail/workaround.hpp>
#include <boost/limits.hpp>
#include <boost/cstdint.hpp>
#include <boost/serialization/access.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
#include <boost/archive/dinkumware.hpp>
#endif
#endif
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/string.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#if defined(A_IMPORT)
#define DLL_DECL BOOST_SYMBOL_IMPORT
#define A_DLL_DECL BOOST_SYMBOL_IMPORT
#pragma message("A imported")
#elif defined(A_EXPORT)
#define DLL_DECL BOOST_SYMBOL_EXPORT
#define A_DLL_DECL BOOST_SYMBOL_EXPORT
#pragma message ("A exported")
#else
#define DLL_DECL
#define A_DLL_DECL
#endif
class DLL_DECL A
{
class A_DLL_DECL A {
private:
friend class boost::serialization::access;
// note: from an aesthetic perspective, I would much prefer to have this
// defined out of line. Unfortunately, this trips a bug in the VC 6.0
// compiler. So hold our nose and put it her to permit running of tests.
// mscvc 6.0 requires template functions to be implemented. For this
// reason we can't make abstract.
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template<class Archive>
void serialize(
Archive &ar,
const unsigned int /* file_version */
){
ar & BOOST_SERIALIZATION_NVP(b);
#ifndef BOOST_NO_INT64_T
ar & BOOST_SERIALIZATION_NVP(f);
ar & BOOST_SERIALIZATION_NVP(g);
#endif
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 )
int i;
if(BOOST_DEDUCED_TYPENAME Archive::is_saving::value){
i = l;
ar & BOOST_SERIALIZATION_NVP(i);
}
else{
ar & BOOST_SERIALIZATION_NVP(i);
l = i;
}
#else
ar & BOOST_SERIALIZATION_NVP(l);
#endif
ar & BOOST_SERIALIZATION_NVP(m);
ar & BOOST_SERIALIZATION_NVP(n);
ar & BOOST_SERIALIZATION_NVP(o);
ar & BOOST_SERIALIZATION_NVP(p);
ar & BOOST_SERIALIZATION_NVP(q);
#ifndef BOOST_NO_CWCHAR
ar & BOOST_SERIALIZATION_NVP(r);
#endif
ar & BOOST_SERIALIZATION_NVP(c);
ar & BOOST_SERIALIZATION_NVP(s);
ar & BOOST_SERIALIZATION_NVP(t);
ar & BOOST_SERIALIZATION_NVP(u);
ar & BOOST_SERIALIZATION_NVP(v);
ar & BOOST_SERIALIZATION_NVP(w);
ar & BOOST_SERIALIZATION_NVP(x);
ar & BOOST_SERIALIZATION_NVP(y);
#ifndef BOOST_NO_STD_WSTRING
ar & BOOST_SERIALIZATION_NVP(z);
#endif
}
#else
template<class Archive>
void serialize(
Archive &ar,
const unsigned int /* file_version */
);
#endif
template<class Archive>
void serialize(
Archive &ar,
const unsigned int /* file_version */
);
bool b;
#ifndef BOOST_NO_INT64_T
boost::int64_t f;
@@ -152,6 +91,4 @@ public:
friend std::ostream & operator<<(std::ostream & os, A const & a);
};
#undef DLL_DECL
#endif // BOOST_SERIALIZATION_TEST_A_HPP
+1 -5
View File
@@ -8,13 +8,11 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/detail/workaround.hpp>
#if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
#include <boost/archive/dinkumware.hpp>
#endif
#include <boost/serialization/nvp.hpp>
#include "A.hpp"
template<class Archive>
@@ -60,5 +58,3 @@ void A::serialize(
ar & BOOST_SERIALIZATION_NVP(z);
#endif
}
#endif // workaround BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+3
View File
@@ -84,6 +84,7 @@ test-suite "serialization" :
[ test-bsl-run_files test_list : A ]
[ test-bsl-run_files test_list_ptrs : A ]
[ test-bsl-run_files test_map : A ]
[ test-bsl-run_files test_map_hashed : A : : [ requires hash ] ] # BOOST_HAS_HASH
[ test-bsl-run_files test_map_unordered : A : : [ requires cxx11_hdr_unordered_map ] ] # BOOST_NO_CXX11_HDR_UNORDERED_MAP
[ test-bsl-run_files test_map_boost_unordered : A ]
[ test-bsl-run_files test_mi ]
@@ -107,6 +108,8 @@ test-suite "serialization" :
[ test-bsl-run_files test_set_boost_unordered : A ]
[ test-bsl-run_files test_simple_class : A ]
[ test-bsl-run_files test_simple_class_ptr : A ]
[ test-bsl-run_files test_slist : A : : [ requires slist ] ] # BOOST_HAS_SLIST ]
[ test-bsl-run_files test_slist_ptrs : A : : [ requires slist ] ] # BOOST_HAS_SLIST ] ]
[ test-bsl-run_files test_split ]
[ test-bsl-run_files test_stack : A ]
[ test-bsl-run_files test_tracking ]
+8 -4
View File
@@ -1,3 +1,4 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// dll_a.cpp
@@ -20,12 +21,13 @@
#include <boost/archive/text_iarchive.hpp>
template
BOOST_SYMBOL_EXPORT void A::serialize(
A_DLL_DECL void A::serialize(
boost::archive::text_oarchive &ar,
const unsigned int /* file_version */
);
template
BOOST_SYMBOL_EXPORT void A::serialize(
A_DLL_DECL
void A::serialize(
boost::archive::text_iarchive &ar,
const unsigned int /* file_version */
);
@@ -36,12 +38,14 @@ BOOST_SYMBOL_EXPORT void A::serialize(
#include <boost/archive/polymorphic_iarchive.hpp>
template
BOOST_SYMBOL_EXPORT void A::serialize(
A_DLL_DECL
void A::serialize(
boost::archive::polymorphic_oarchive &ar,
const unsigned int /* file_version */
);
template
BOOST_SYMBOL_EXPORT void A::serialize(
A_DLL_DECL
void A::serialize(
boost::archive::polymorphic_iarchive &ar,
const unsigned int /* file_version */
);
-8
View File
@@ -10,14 +10,6 @@
#include <boost/serialization/export.hpp>
#define POLYMORPHIC_BASE_EXPORT
#include "polymorphic_base.hpp"
BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_base)
const char * polymorphic_base::get_key() const{
return
boost::serialization::type_info_implementation<
polymorphic_base
>::type::get_const_instance().get_key();
}
-10
View File
@@ -24,14 +24,6 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#if defined(POLYMORPHIC_BASE_IMPORT)
#define DLL_DECL BOOST_SYMBOL_IMPORT
#elif defined(POLYMORPHIC_BASE_EXPORT)
#define DLL_DECL BOOST_SYMBOL_EXPORT
#else
#define DLL_DECL
#endif
class BOOST_SYMBOL_VISIBLE polymorphic_base
{
friend class boost::serialization::access;
@@ -48,8 +40,6 @@ public:
virtual ~polymorphic_base(){};
};
#undef DLL_DECL
BOOST_SERIALIZATION_ASSUME_ABSTRACT(polymorphic_base)
// the no_rtti system requires this !!!
+14 -5
View File
@@ -27,11 +27,15 @@ void polymorphic_derived2::serialize(
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
template
POLYMORPHIC_DERIVED2_DLL_DECL
void polymorphic_derived2::serialize(
boost::archive::text_oarchive & ar,
const unsigned int version
);
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
template
POLYMORPHIC_DERIVED2_DLL_DECL
void polymorphic_derived2::serialize(
boost::archive::text_iarchive & ar,
const unsigned int version
);
@@ -40,11 +44,15 @@ template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
#include <boost/archive/polymorphic_iarchive.hpp>
#include <boost/archive/polymorphic_oarchive.hpp>
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
template
POLYMORPHIC_DERIVED2_DLL_DECL
void polymorphic_derived2::serialize(
boost::archive::polymorphic_oarchive & ar,
const unsigned int version
);
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
template
POLYMORPHIC_DERIVED2_DLL_DECL
void polymorphic_derived2::serialize(
boost::archive::polymorphic_iarchive & ar,
const unsigned int version
);
@@ -60,6 +68,7 @@ BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived2)
BOOST_SERIALIZATION_FACTORY_0(polymorphic_derived2)
template
BOOST_SYMBOL_EXPORT void polymorphic_derived2 *
POLYMORPHIC_DERIVED2_DLL_DECL
void polymorphic_derived2 *
boost::serialization::factory<polymorphic_derived2, 0>(std::va_list ap);
#endif
+6 -8
View File
@@ -24,19 +24,19 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_typeid.hpp>
#include <boost/preprocessor/empty.hpp>
#include "polymorphic_base.hpp"
#if defined(POLYMORPHIC_DERIVED2_IMPORT)
#define DLL_DECL BOOST_SYMBOL_IMPORT
#define POLYMORPHIC_DERIVED2_DLL_DECL BOOST_SYMBOL_IMPORT
#pragma message ("polymorphic_derived2 imported")
#elif defined(POLYMORPHIC_DERIVED2_EXPORT)
#define DLL_DECL BOOST_SYMBOL_EXPORT
#define POLYMORPHIC_DERIVED2_DLL_DECL BOOST_SYMBOL_EXPORT
#pragma message ("polymorphic_derived2 exported")
#else
#define DLL_DECL
#define POLYMORPHIC_DERIVED2_DLL_DECL
#endif
class DLL_DECL polymorphic_derived2 :
class POLYMORPHIC_DERIVED2_DLL_DECL polymorphic_derived2 :
public polymorphic_base
{
friend class boost::serialization::access;
@@ -63,7 +63,5 @@ BOOST_CLASS_TYPE_INFO(
boost::serialization::extended_type_info_typeid<polymorphic_derived2>
)
#undef DLL_DECL
#endif // POLYMORPHIC_DERIVED2_HPP
+1 -1
View File
@@ -23,7 +23,7 @@ namespace std{
#include "test_tools.hpp"
#include <boost/core/no_exceptions_support.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/array.hpp>
#include <boost/serialization/boost_array.hpp>
#include "A.hpp"
#include "A.ipp"
+1 -2
View File
@@ -45,7 +45,6 @@ namespace std{
#include <boost/serialization/export.hpp>
#include <boost/serialization/access.hpp>
#define POLYMORPHIC_BASE_IMPORT
#include "polymorphic_base.hpp"
class polymorphic_derived1 : public polymorphic_base
@@ -67,7 +66,7 @@ BOOST_CLASS_EXPORT(polymorphic_derived1)
// MWerks users can do this to make their code work
BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived1)
#define POLYMORPHIC_DERIVED_IMPORT
#define POLYMORPHIC_DERIVED2_IMPORT
#include "polymorphic_derived2.hpp"
// save exported polymorphic class
+6 -93
View File
@@ -44,89 +44,6 @@ struct ptr_equal_to {
}
};
#include <boost/serialization/list.hpp>
void test_list(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
std::list<A *> alist;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
A * free_a_ptr = new A;
alist.push_back(free_a_ptr);
alist.push_back(new A);
// verify that first element is the same as the free pointer
BOOST_CHECK((*alist.begin()) == free_a_ptr);
oa << boost::serialization::make_nvp("alist", alist);
oa << boost::serialization::make_nvp("free_a_ptr", free_a_ptr);
}
std::list<A *> alist1;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
A * free_a_ptr1;
ia >> boost::serialization::make_nvp("alist", alist1);
ia >> boost::serialization::make_nvp("free_a_ptr", free_a_ptr1);
BOOST_CHECK(
alist.size() == alist1.size()
&& std::equal(alist.begin(),alist.end(),alist1.begin(),ptr_equal_to<A *>())
);
// verify that first element is the same as the free pointer
BOOST_CHECK((*alist1.begin()) == free_a_ptr1);
}
std::for_each(
alist.begin(),
alist.end(),
boost::checked_deleter<A>()
);
std::for_each(
alist1.begin(),
alist1.end(),
boost::checked_deleter<A>()
);
std::remove(testfile);
}
#ifdef BOOST_HAS_SLIST
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
std::list<A *> aslist;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
aslist.push_back(new A);
aslist.push_back(new A);
oa << boost::serialization::make_nvp("aslist", aslist);
}
std::list<A *> aslist1;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
BOOST_CHECK(aslist.size() == aslist1.size() &&
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
);
}
std::for_each(
aslist.begin(),
aslist.end(),
boost::checked_deleter<A>()
);
std::for_each(
aslist1.begin(),
aslist1.end(),
boost::checked_deleter<A>()
);
std::remove(testfile);
}
#endif
#ifndef BOOST_NO_CXX11_HDR_FORWARD_LIST
#include <boost/serialization/forward_list.hpp>
void test_forward_list(){
const char * testfile = boost::archive::tmpnam(NULL);
@@ -146,7 +63,12 @@ void test_forward_list(){
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
BOOST_CHECK(
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
std::equal(
aslist.begin(),
aslist.end(),
aslist1.begin(),
ptr_equal_to<A *>()
)
);
}
std::for_each(
@@ -161,19 +83,10 @@ void test_forward_list(){
);
std::remove(testfile);
}
#endif
int test_main( int /* argc */, char* /* argv */[] )
{
test_list();
#ifdef BOOST_HAS_SLIST
test_slist();
#endif
#ifndef BOOST_NO_CXX11_HDR_FORWARD_LIST
test_forward_list();
#endif
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -29,7 +29,7 @@ namespace std{
struct test_dummy_out {
template<class Archive>
void save(Archive & ar, const unsigned int /*version*/) const {
void save(Archive &, const unsigned int /*version*/) const {
throw boost::archive::archive_exception(
boost::archive::archive_exception::other_exception
);
-27
View File
@@ -49,36 +49,9 @@ void test_list(){
std::remove(testfile);
}
#ifdef BOOST_HAS_SLIST
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist;
aslist.push_front(A());
aslist.push_front(A());
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
oa << boost::serialization::make_nvp("aslist", aslist);
}
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist1;{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
}
BOOST_CHECK(aslist == aslist1);
std::remove(testfile);
}
#endif
int test_main( int /* argc */, char* /* argv */[] )
{
test_list();
#ifdef BOOST_HAS_SLIST
test_slist();
#endif
return EXIT_SUCCESS;
}
-42
View File
@@ -89,51 +89,9 @@ void test_list(){
std::remove(testfile);
}
#ifdef BOOST_HAS_SLIST
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
std::list<A *> aslist;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
aslist.push_back(new A);
aslist.push_back(new A);
oa << boost::serialization::make_nvp("aslist", aslist);
}
std::list<A *> aslist1;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
BOOST_CHECK(aslist.size() == aslist1.size() &&
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
);
}
std::for_each(
aslist.begin(),
aslist.end(),
boost::checked_deleter<A>()
);
std::for_each(
aslist1.begin(),
aslist1.end(),
boost::checked_deleter<A>()
);
std::remove(testfile);
}
#endif
int test_main( int /* argc */, char* /* argv */[] )
{
test_list();
#ifdef BOOST_HAS_SLIST
test_slist();
#endif
return EXIT_SUCCESS;
}
-1
View File
@@ -23,7 +23,6 @@ namespace std{
#include "test_tools.hpp"
#include <boost/core/no_exceptions_support.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/array.hpp>
#include "A.hpp"
#include "A.ipp"
+55
View File
@@ -0,0 +1,55 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// test_list.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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)
// should pass compilation and execution
#include <cstddef> // NULL
#include <fstream>
#include <boost/config.hpp>
#include <cstdio> // remove
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::remove;
}
#endif
#include <boost/archive/archive_exception.hpp>
#include "test_tools.hpp"
#include "A.hpp"
#include "A.ipp"
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist;
aslist.push_front(A());
aslist.push_front(A());
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
oa << boost::serialization::make_nvp("aslist", aslist);
}
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist1;{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
}
BOOST_CHECK(aslist == aslist1);
std::remove(testfile);
}
int test_main( int /* argc */, char* /* argv */[] )
{
test_slist();
return EXIT_SUCCESS;
}
// EOF
+88
View File
@@ -0,0 +1,88 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// test_list.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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)
// should pass compilation and execution
#include <cstddef>
#include <fstream>
#include <boost/config.hpp>
#include <cstdio> // remove
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::remove;
}
#endif
#include <boost/type_traits/is_pointer.hpp>
#include <boost/static_assert.hpp>
#include <boost/checked_delete.hpp>
#include <boost/archive/archive_exception.hpp>
#include "test_tools.hpp"
#include <boost/serialization/nvp.hpp>
#include "A.hpp"
#include "A.ipp"
template<class T>
struct ptr_equal_to {
BOOST_STATIC_ASSERT(::boost::is_pointer< T >::value);
bool operator()(T const _Left, T const _Right) const
{
if(NULL == _Left && NULL == _Right)
return true;
if(typeid(*_Left) != typeid(*_Right))
return false;
return *_Left == *_Right;
}
};
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
std::list<A *> aslist;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
aslist.push_back(new A);
aslist.push_back(new A);
oa << boost::serialization::make_nvp("aslist", aslist);
}
std::list<A *> aslist1;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
BOOST_CHECK(aslist.size() == aslist1.size() &&
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
);
}
std::for_each(
aslist.begin(),
aslist.end(),
boost::checked_deleter<A>()
);
std::for_each(
aslist1.begin(),
aslist1.end(),
boost::checked_deleter<A>()
);
std::remove(testfile);
}
int test_main( int /* argc */, char* /* argv */[] )
{
test_slist();
return EXIT_SUCCESS;
}
// EOF
-3
View File
@@ -19,7 +19,6 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <cstddef> // size_t
#include <boost/config.hpp>
#ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE
#include <exception>
@@ -77,14 +76,12 @@ namespace boost {
namespace archive {
const char * test_filename(const char * dir = NULL, char *fname = NULL){
static char ibuffer [512];
std::size_t i;
ibuffer[0] = '\0';
if(NULL == dir){
dir = boost::archive::tmpdir();
}
STRCPY(ibuffer, dir);
std::strcat(ibuffer, "/");
i = std::strlen(ibuffer);
if(NULL == fname){
char old_dir[256];
_getcwd(old_dir, sizeof(old_dir) - 1);