Skip to content

LowCostCustoms/cereal-optional

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cereal-optional

Optional NVP for cereal

Usage:

// contains base Optional NVP definition
#include <cereal_optional/optional_nvp.hpp>

// contains definitions required by JSON archives
#include <cereal_optional/optional_json.hpp>

// contains definitions required by binary archives
#include <cereal_optional/optional_binary.hpp>


struct MyAwesomeStruct {
  std::string optional;
  
  template<class A>
  void serialize(A &archive) {
    archive(CEREAL_OPTIONAL_NVP(optional)
      // or CEREAL_OPTIONAL_NVP(optional, "my default value")
      // or cereal::make_optional_nvp("foo", optional)
      // or cereal::make_optional_nvp("foo", optional, "my default value")
      );
  }
};

Repo contains a CMake project, you just have to link cereal-optional project with yours.

About

Optional NVP for cereal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published