File indexing completed on 2025-12-16 10:08:44
0001 #ifndef BOOST_SERIALIZATION_DETAIL_STACK_CONSTRUCTOR_HPP
0002 #define BOOST_SERIALIZATION_DETAIL_STACK_CONSTRUCTOR_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <boost/aligned_storage.hpp>
0020 #include <boost/serialization/serialization.hpp>
0021
0022 namespace boost{
0023 namespace serialization {
0024 namespace detail {
0025
0026
0027
0028 template<typename T >
0029 struct stack_allocate
0030 {
0031 T * address() {
0032 return static_cast<T*>(storage_.address());
0033 }
0034 T & reference() {
0035 return * address();
0036 }
0037 private:
0038 typedef typename boost::aligned_storage<
0039 sizeof(T),
0040 boost::alignment_of<T>::value
0041 > type;
0042 type storage_;
0043 };
0044
0045
0046 template<class Archive, class T>
0047 struct stack_construct : public stack_allocate<T>
0048 {
0049 stack_construct(Archive & ar, const unsigned int version){
0050
0051 boost::serialization::load_construct_data_adl(
0052 ar,
0053 this->address(),
0054 version
0055 );
0056 }
0057 ~stack_construct(){
0058 this->address()->~T();
0059 }
0060 };
0061
0062 }
0063 }
0064 }
0065
0066 #endif