11#include <Sawyer/Sawyer.h>
12#include <Sawyer/Optional.h>
48#ifdef SAWYER_HAVE_BOOST_SERIALIZATION
50 friend class boost::serialization::access;
53 void serialize(S &s,
const unsigned ) {
54 s & BOOST_SERIALIZATION_NVP(value_);
58#ifdef SAWYER_HAVE_CEREAL
60 friend class cereal::access;
62 template<
class Archive>
63 void CEREAL_SERIALIZE_FUNCTION_NAME(Archive &archive) {
64 archive(CEREAL_NVP(value_));
113 return &value_.
get();
116 return &value_.
get();
Implements cache data members.
bool isCached() const
Cached state.
const Cached & operator=(const Value &x) const
Assign a new value.
const Value & get() const
Return the cached value.
T Value
Type of stored value.
Value * operator->()
Return pointer to cached value.
const Value & operator*() const
Return the cached value.
const Value * operator->() const
Return pointer to cached value.
void set(const Value &x) const
Assign a new value.
Value & operator*()
Return the cached value.
Value & get()
Return the cached value.
const Sawyer::Optional< Value > & getOptional() const
Return cached value or nothing.
void clear() const
Remove cached value.
Cached()
Initialize to an empty value.
Holds a value or nothing.
const Value & get() const
Dereference to obtain value.