46 template<
typename type_t>
49 using underlying_type = type_t;
60 template<
typename ...args_t>
61 box(args_t&& ...args) : value_(args...) {}
67 box& operator =(
const box&) =
default;
68 box& operator =(
const type_t&
value) {
79 const type_t&
value() const noexcept {
return value_;}
82 type_t&
value() noexcept {
return value_;}
94 operator type_t()
const noexcept {
return value_;}
100 bool equals(
const box& value)
const noexcept
override {
return value_ == value.value_;}
103 if (value_ == value.value_)
return 0;
104 if (value_ < value.value_)
return -1;
Contains xtd fundamental types.
Contains xtd::iequatable interface.
Contains xtd::icomparable interface.
Represents a boxed object.
Definition: box.h:47
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition: icomparable.h:17
box()=default
Initialize a new xtd::box object.
xtd::ustring to_string() const noexcept override
Returns a sxd::ustring that represents the current object.
Definition: box.h:113
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
const type_t & value() const noexcept
Gets the underlying value.
Definition: box.h:79
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
static bool try_parse(const xtd::ustring &value, type_t &result) noexcept
Converts the string to its type_t equivalent. A return value indicates whether the conversion succeed...
Definition: box.h:125
Contains enum_ and enum_ut_ keywords.
box(args_t &&...args)
Initialize a new xtd::box object with specified value.
Definition: box.h:61
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
static type_t parse(const xtd::ustring &value)
Converts the string to its type_t equivalent.
Definition: box.h:111
xtd::ustring to_string(const xtd::ustring &format) const noexcept
Converts the value of this instance to its equivalent string representation, using the specified form...
Definition: box.h:117
box & value(const type_t &value)
Sets de underlying value.
Definition: box.h:85
Contains xtd::ustring class.
Contains xtd::convert_string class.
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
type_t & value() noexcept
Gets the underlying value.
Definition: box.h:82
box(const type_t &value)
Initialize a new xtd::box object with specified value.
Definition: box.h:57
Contains xtd::invalid_cast_exception exception.
int32 compare_to(const box &value) const noexcept override
Compares the current instance with another object of the same type.
Definition: box.h:102
bool equals(const box &value) const noexcept override
Indicates whether the current object is equal to another object of the same type. ...
Definition: box.h:100