| cereal
    A C++11 library for serialization | 
For holding name value pairs. More...
#include </home/shane/workspace/cereal/include/cereal/details/helpers.hpp>
 
  
| Public Member Functions | |
| NameValuePair (char const *n, T &&v) | |
| Constructs a new NameValuePair.  More... | |
| Public Attributes | |
| const char * | name | 
| Type | value | 
| Related Functions | |
| (Note that these are not member functions.) | |
| template<class T > | |
| NameValuePair< T > | make_nvp (std::string const &name, T &&value) | 
| Creates a name value pair. | |
| template<class T > | |
| NameValuePair< T > | make_nvp (const char *name, T &&value) | 
| Creates a name value pair. | |
| template<class Archive , class T > | |
| std::enable_if< std::is_same< Archive,::cereal::BinaryInputArchive >::value||std::is_same< Archive,::cereal::BinaryOutputArchive >::value, T && >::type | make_nvp (const char *, T &&value) | 
| A specialization of make_nvp<> that simply forwards the value for binary archives. | |
| template<class Archive , class T > | |
| std::enable_if<!std::is_same< Archive,::cereal::BinaryInputArchive >::value &&!std::is_same< Archive,::cereal::BinaryOutputArchive >::value, NameValuePair< T > >::type | make_nvp (const char *name, T &&value) | 
| A specialization of make_nvp<> that actually creates an nvp for non-binary archives. | |
For holding name value pairs.
This pairs a name (some string) with some value such that an archive can potentially take advantage of the pairing.
In serialization functions, NameValuePairs are usually created like so:
Alternatively, you can give you data members custom names like so:
There is a slight amount of overhead to creating NameValuePairs, so there is a third method which will elide the names when they are not used by the Archive:
This third method is generally only used when providing generic type support. Users writing their own serialize functions will normally explicitly control whether they want to use NVPs or not.
| 
 | inline | 
Constructs a new NameValuePair.
| n | The name of the pair | 
| v | The value to pair. Ideally this should be an l-value reference so that the value can be both loaded and saved to. If you pass an r-value reference, the NameValuePair will store a copy of it instead of a reference. Thus you should only pass r-values in cases where this makes sense, such as the result of some size() call. | 
 1.8.17
 1.8.17