Go to the documentation of this file.
23 #ifndef COM_DAFER45_TBTK_NATURAL
24 #define COM_DAFER45_TBTK_NATURAL
28 #ifndef TBTK_DISABLE_NLOHMANN_JSON
29 # include "TBTK/json.hpp"
34 #if TBTK_WRAP_PRIMITIVE_TYPES
45 constexpr
Natural(
unsigned int value) : value(value) {}
56 constexpr
operator unsigned int()
const{
return value; };
160 #ifndef TBTK_DISABLE_NLOHMANN_JSON
166 nlohmann::to_json(j, natural.value);
174 nlohmann::from_json(j, natural.value);
183 const std::string &serialization,
187 case Serializable::Mode::JSON:
188 value = stoul(serialization);
192 "Natural::Natural()",
193 "Only Serializable::Mode::JSON is supported yet.",
201 case Serializable::Mode::JSON:
202 return std::to_string(value);
205 "Natural::serialize()",
206 "Only Serializable::Mode::JSON is supported yet.",
Natural & operator/=(const Natural &rhs)
Definition: Natural.h:107
friend void to_json(nlohmann::json &j, const Natural &natural)
Definition: Natural.h:165
Natural & operator=(unsigned int rhs)
Definition: Natural.h:63
Natural & operator*=(const Natural &rhs)
Definition: Natural.h:96
Natural & operator+=(const Natural &rhs)
Definition: Natural.h:74
Natural number.
Definition: Natural.h:37
Natural operator--(int)
Definition: Natural.h:144
Natural & operator++()
Definition: Natural.h:116
Natural()
Definition: Natural.h:40
constexpr Natural(unsigned int value)
Definition: Natural.h:45
Natural & operator-=(const Natural &rhs)
Definition: Natural.h:85
friend void from_json(const nlohmann::json &j, Natural &natural)
Definition: Natural.h:173
Natural & operator--()
Definition: Natural.h:135
Base class for psudo-serializable objects.
Mode
Definition: Serializable.h:47
Natural operator++(int)
Definition: Natural.h:125
Definition: PseudoSerializable.h:31
std::string serialize(Serializable::Mode mode) const
Definition: Natural.h:199