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_;}
103 if (value_ ==
value.value_)
return 0;
104 if (value_ <
value.value_)
return -1;
Represents a boxed object.
Definition box.h:47
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:112
box & value(const type_t &value)
Sets de underlying value.
Definition box.h:85
type_t & value() noexcept
Gets the underlying value.
Definition box.h:82
box(args_t &&...args)
Initialize a new xtd::box object with specified value.
Definition box.h:61
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
box(const type_t &value)
Initialize a new xtd::box object with specified value.
Definition box.h:57
box()=default
Initialize a new xtd::box object.
static type_t parse(const xtd::ustring &value)
Converts the string to its type_t equivalent.
Definition box.h:123
int32 compare_to(const box &value) const noexcept override
Compares the current instance with another object of the same type.
Definition box.h:102
const type_t & value() const noexcept
Gets the underlying value.
Definition box.h:79
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:129
xtd::ustring to_string() const noexcept override
Returns a sxd::ustring that represents the current object.
Definition box.h:108
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.h:17
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:18
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Contains xtd::convert_string class.
Contains enum_ and enum_ut_ keywords.
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
Contains xtd::invalid_cast_exception exception.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::object class.
Contains xtd fundamental types.
Contains xtd::ustring class.