30#ifndef CEREAL_TYPES_QUEUE_HPP_
31#define CEREAL_TYPES_QUEUE_HPP_
43 namespace queue_detail
47 template <
class T,
class C>
inline
48 C
const &
container( std::queue<T, C>
const & queue )
50 struct H :
public std::queue<T, C>
52 static C
const & get( std::queue<T, C>
const & q )
58 return H::get( queue );
63 template <
class T,
class C,
class Comp>
inline
64 C
const &
container( std::priority_queue<T, C, Comp>
const & priority_queue )
66 struct H :
public std::priority_queue<T, C, Comp>
68 static C
const & get( std::priority_queue<T, C, Comp>
const & pq )
74 return H::get( priority_queue );
79 template <
class T,
class C,
class Comp>
inline
80 Comp
const &
comparator( std::priority_queue<T, C, Comp>
const & priority_queue )
82 struct H :
public std::priority_queue<T, C, Comp>
84 static Comp
const & get( std::priority_queue<T, C, Comp>
const & pq )
86 return pq.*(&H::comp);
90 return H::get( priority_queue );
95 template <
class Archive,
class T,
class C>
inline
98 ar(
CEREAL_NVP_(
"container", queue_detail::container( queue )) );
102 template <
class Archive,
class T,
class C>
inline
107 queue = std::queue<T, C>( std::move( container ) );
111 template <
class Archive,
class T,
class C,
class Comp>
inline
114 ar(
CEREAL_NVP_(
"comparator", queue_detail::comparator( priority_queue )) );
115 ar(
CEREAL_NVP_(
"container", queue_detail::container( priority_queue )) );
119 template <
class Archive,
class T,
class C,
class Comp>
inline
128 priority_queue = std::priority_queue<T, C, Comp>( comparator, std::move( container ) );
Support for types found in <deque>
Support for types found in <functional>
Internal helper functionality.
#define CEREAL_NVP_(name, value)
Convenience for creating a templated NVP.
Definition: helpers.hpp:201
#define CEREAL_LOAD_FUNCTION_NAME
The deserialization (load) function name to search for.
Definition: macros.hpp:85
#define CEREAL_SAVE_FUNCTION_NAME
The serialization (save) function name to search for.
Definition: macros.hpp:92
Comp const & comparator(std::priority_queue< T, C, Comp > const &priority_queue)
Allows access to the protected comparator in priority queue.
Definition: queue.hpp:80
C const & container(std::queue< T, C > const &queue)
Allows access to the protected container in queue.
Definition: queue.hpp:48