Server IP : 104.21.38.3 / Your IP : 162.158.108.167 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/boost/boost_1_59_0/boost/serialization/ |
Upload File : |
#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 <boost/config.hpp> // msvc 6.0 needs this for warning suppression #include <iostream> #include <cstddef> // std::size_t #ifndef BOOST_NO_CXX11_HDR_ARRAY #include <array> #endif #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/mpl/always.hpp> #include <boost/mpl/apply.hpp> #include <boost/mpl/bool.hpp> #include <boost/type_traits/remove_const.hpp> #include <boost/array.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 : public wrapper_traits<const array< T > > { public: typedef T value_type; array(value_type* t, std::size_t s) : m_t(t), m_element_count(s) {} array(const array & rhs) : m_t(rhs.m_t), m_element_count(rhs.m_element_count) {} array & operator=(const array & rhs){ m_t = rhs.m_t; m_element_count = rhs.m_element_count; } // 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(); value_type * 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()); } value_type* address() const { return m_t; } std::size_t count() const { return m_element_count; } private: value_type* m_t; std::size_t m_element_count; }; template<class T> inline const array< T > make_array( T* t, std::size_t s){ return array< T >(t, s); } // 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); } #ifndef BOOST_NO_CXX11_HDR_ARRAY // 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 */) { ar & boost::serialization::make_nvp( "elems", *static_cast<T (*)[N]>(static_cast<void *>(a.data())) ); } #endif } } // 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_HPP