]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/scope_exit/test/world_tpl_seq.cpp
2 // Copyright (C) 2006-2009, 2012 Alexander Nasonov
3 // Copyright (C) 2012 Lorenzo Caminiti
4 // Distributed under the Boost Software License, Version 1.0
5 // (see accompanying file LICENSE_1_0.txt or a copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 // Home at http://www.boost.org/libs/scope_exit
9 #include <boost/scope_exit.hpp>
10 #include <boost/typeof/typeof.hpp>
11 #include <boost/typeof/std/vector.hpp>
12 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
13 #include <boost/detail/lightweight_test.hpp>
17 BOOST_TYPEOF_REGISTER_TYPE(person
)
19 template<typename Person
>
21 void add_person(Person
const& a_person
);
22 size_t population(void) const { return persons_
.size(); }
25 std::vector
<Person
> persons_
;
27 BOOST_TYPEOF_REGISTER_TEMPLATE(world
, 1)
29 template<typename Person
>
30 void world
<Person
>::add_person(Person
const& a_person
) {
32 persons_
.push_back(a_person
);
34 BOOST_SCOPE_EXIT_TPL( (&commit
) (this_
) ) {
35 if(!commit
) this_
->persons_
.pop_back();
36 } BOOST_SCOPE_EXIT_END
47 BOOST_TEST(w
.population() == 1);
48 return boost::report_errors();