]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // (C) Copyright 2007 Matthias Troyer |
2 | ||
3 | // Use, modification and distribution is subject to the Boost Software | |
4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
7 | // Authors: Matthias Troyer | |
8 | ||
9 | /** @file is_bitwise_serializable.hpp | |
10 | * | |
11 | * This header provides a traits class for determining whether a class | |
12 | * can be serialized (in a non-portable way) just by copying the bits. | |
13 | */ | |
14 | ||
15 | ||
16 | #ifndef BOOST_SERIALIZATION_IS_BITWISE_SERIALIZABLE_HPP | |
17 | #define BOOST_SERIALIZATION_IS_BITWISE_SERIALIZABLE_HPP | |
18 | ||
19 | // MS compatible compilers support #pragma once | |
20 | #if defined(_MSC_VER) | |
21 | # pragma once | |
22 | #endif | |
23 | ||
24 | #include <boost/mpl/bool_fwd.hpp> | |
25 | #include <boost/type_traits/is_arithmetic.hpp> | |
26 | ||
27 | namespace boost { | |
28 | namespace serialization { | |
29 | template<class T> | |
30 | struct is_bitwise_serializable | |
31 | : public is_arithmetic< T > | |
32 | {}; | |
33 | } // namespace serialization | |
34 | } // namespace boost | |
35 | ||
36 | ||
37 | // define a macro to make explicit designation of this more transparent | |
38 | #define BOOST_IS_BITWISE_SERIALIZABLE(T) \ | |
39 | namespace boost { \ | |
40 | namespace serialization { \ | |
41 | template<> \ | |
42 | struct is_bitwise_serializable< T > : mpl::true_ {}; \ | |
43 | }} \ | |
44 | /**/ | |
45 | ||
46 | #endif //BOOST_SERIALIZATION_IS_BITWISE_SERIALIZABLE_HPP |