]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/serialization/test/test_forward_list_ptrs.cpp
1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
4 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // should pass compilation and execution
14 #include <boost/config.hpp>
15 #include <cstdio> // remove
16 #if defined(BOOST_NO_STDC_NAMESPACE)
22 #include <boost/type_traits/is_pointer.hpp>
23 #include <boost/static_assert.hpp>
24 #include <boost/checked_delete.hpp>
26 #include <boost/archive/archive_exception.hpp>
27 #include "test_tools.hpp"
29 #include <boost/serialization/nvp.hpp>
36 BOOST_STATIC_ASSERT(::boost::is_pointer
< T
>::value
);
37 bool operator()(T
const _Left
, T
const _Right
) const
39 if(NULL
== _Left
&& NULL
== _Right
)
41 if(typeid(*_Left
) != typeid(*_Right
))
43 return *_Left
== *_Right
;
47 #include <boost/serialization/forward_list.hpp>
48 void test_forward_list(){
49 const char * testfile
= boost::archive::tmpnam(NULL
);
50 BOOST_REQUIRE(NULL
!= testfile
);
52 std::forward_list
<A
*> aslist
;
54 test_ostream
os(testfile
, TEST_STREAM_FLAGS
);
55 test_oarchive
oa(os
, TEST_ARCHIVE_FLAGS
);
56 aslist
.push_front(new A
);
57 aslist
.push_front(new A
);
58 oa
<< boost::serialization::make_nvp("aslist", aslist
);
60 std::forward_list
<A
*> aslist1
;
62 test_istream
is(testfile
, TEST_STREAM_FLAGS
);
63 test_iarchive
ia(is
, TEST_ARCHIVE_FLAGS
);
64 ia
>> boost::serialization::make_nvp("aslist", aslist1
);
77 boost::checked_deleter
<A
>()
82 boost::checked_deleter
<A
>()
84 std::remove(testfile
);
87 int test_main( int /* argc */, char* /* argv */[] )