Boost logo

Boost Users :

From: Jeffrey Holle (jeffreyholle_at_[hidden])
Date: 2005-12-06 13:31:25


Shouldn't the get_aux::get method be explicitally inlined?
This should make the M$ pragma unnecessary.

Felipe Magno de Almeida wrote:
> Hi,
>
> On 12/1/05, Robert Ramey <ramey_at_[hidden]> wrote:
>
>
> [snip]
>
>
>>There isn't, You'll have to make yourself. When you do upload it to the
>>vault
>
>
> Is this a reasonable implementation?
> I didnt knew how the better way to call the serialization of something
> inside the serialization code, so I called the serialize free function
> to serialize the stack internal container. Hope it works for types
> other than the STL containers.
>
>
>>Robert Ramey
>>
>
>
> --
> Felipe Magno de Almeida
> Developer from synergy and Computer Science student from State
> University of Campinas(UNICAMP).
> Unicamp: http://www.ic.unicamp.br
> Synergy: http://www.synergy.com.br
> "There is no dark side of the moon really. Matter of fact it's all dark."
>
>
> ------------------------------------------------------------------------
>
> #ifndef BOOST_SERIALIZATION_STACK_HPP
> #define BOOST_SERIALIZATION_STACK_HPP
>
> // MS compatible compilers support #pragma once
> #if defined(_MSC_VER) && (_MSC_VER >= 1020)
> # pragma once
> #endif
>
> /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
> // stack.hpp
>
> // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
> // 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)
>
> // See http://www.boost.org for updates, documentation, and revision history.
>
> #include <deque>
>
> #include <boost/config.hpp>
>
> #include <boost/serialization/collections_save_imp.hpp>
> #include <boost/serialization/collections_load_imp.hpp>
>
> #include <stack>
>
> // function specializations must be defined in the appropriate
> // namespace - boost::serialization
> #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
> #define STD _STLP_STD
> #else
> #define STD std
> #endif
>
> namespace boost {
> namespace serialization {
> namespace stack_detail
> {
>
> // needed to have access to the c protected member
> template <typename U, typename C>
> struct get_aux : STD::stack<U, C>
> {
> static C& get(STD::stack<U, C>& s)
> {
> return s.c;
> }
> };
>
> // for template argument detection
> template <typename U, typename C>
> C& get(STD::stack<U, C>& s)
> {
> return get_aux<U, C>::get(s);
> }
>
> }
>
> // serialize the internal's stack container
> template<class Archive, class U, class Container>
> inline void serialize(
> Archive & ar,
> STD::stack<U, Container> &t,
> const unsigned int file_version
> ){
> serialize(ar, stack_detail::get(t), file_version);
> }
>
> } // namespace serialization
> } // namespace boost
>
> #include <boost/serialization/collection_traits.hpp>
>
> BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::stack)
>
> #undef STD
>
> #endif // BOOST_SERIALIZATION_DEQUE_HPP
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net