56 typedef std::optional<value_type> container_type;
61 iName{ aName }, iInstance{
from_string<T>(aValue) } {}
62 custom_type(
const string& aName,
const abstract_value_type& aValue) :
63 iName{ aName }, iInstance{ aValue } {}
65 iName{ aOther.
name() }, iInstance{ aOther.
instance_ptr() ? container_type{aOther.
instance_as<abstract_value_type>()} : container_type{} } {}
87 if (aRhs.name() !=
name())
89 if (iInstance == std::nullopt)
90 iInstance = value_type{ aRhs.instance_as<abstract_value_type>() };
92 *iInstance = aRhs.instance_as<abstract_value_type>();
97 return instance_ptr() == aRhs.instance_ptr() || (
instance_ptr() !=
nullptr && aRhs.instance_ptr() !=
nullptr && instance_as<abstract_value_type>() == aRhs.instance_as<abstract_value_type>());
101 return (
instance_ptr() !=
nullptr && aRhs.instance_ptr() !=
nullptr && instance_as<abstract_value_type>() < aRhs.instance_as<abstract_value_type>()) || (
instance_ptr() < aRhs.instance_ptr());
106 return iInstance != std::nullopt ?
static_cast<const abstract_value_type*
>(&*iInstance) :
static_cast<const abstract_value_type*
>(
nullptr);
110 return iInstance != std::nullopt ?
static_cast<abstract_value_type*
>(&*iInstance) :
static_cast<abstract_value_type*
>(
nullptr);
114 container_type iInstance;
117 template <
typename T>
120 template <
typename T>
126 template <
typename T>
void * instance_ptr() final
void to_string(i_string &aString) const final
bool operator==(const i_custom_type &aRhs) const final
void name(i_string &aName) const final
const void * instance_ptr() const final
i_custom_type & assign(const i_custom_type &aRhs) final
i_custom_type * clone() const final
custom_type(const i_custom_type &aOther)
custom_type(const string &aName, const abstract_value_type &aValue)
bool operator<(const i_custom_type &aRhs) const final
std::string to_string() const
custom_type(const string &aName)
custom_type(const string &aName, const string &aValue)
const T & instance_as() const
std::string to_string() const
typename detail::abstract_type< T >::type abstract_t
const std::string custom_type_name_v
T from_string(i_string const &aValueAsString)
custom_type< T > make_custom_type()