Used inline variables for metaprogramming constants
This commit is contained in:
parent
6d155ced61
commit
3176c7a5a5
11 changed files with 65 additions and 65 deletions
|
@ -145,7 +145,7 @@ public:
|
|||
config_attribute_value& operator=(const std::string &v);
|
||||
config_attribute_value& operator=(const t_string &v);
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_base_of<enum_tag, T>::value, config_attribute_value&> operator=(const T &v)
|
||||
std::enable_if_t<std::is_base_of_v<enum_tag, T>, config_attribute_value&> operator=(const T &v)
|
||||
{
|
||||
return operator=(T::enum_to_string(v));
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
TODO: Fix this in c++11 using constexpr types.
|
||||
*/
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_base_of<enum_tag, T>::value, T> to_enum(const T &v) const
|
||||
std::enable_if_t<std::is_base_of_v<enum_tag, T>, T> to_enum(const T &v) const
|
||||
{
|
||||
return T::string_to_enum(this->str(), v);
|
||||
}
|
||||
|
@ -198,14 +198,14 @@ public:
|
|||
// These function prevent t_string creation in case of c["a"] == "b" comparisons.
|
||||
// The templates are needed to prevent using these function in case of c["a"] == 0 comparisons.
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<const std::string, std::add_const_t<T>>::value, bool>
|
||||
std::enable_if_t<std::is_same_v<const std::string, std::add_const_t<T>>, bool>
|
||||
friend operator==(const config_attribute_value &val, const T &str)
|
||||
{
|
||||
return val.equals(str);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<const char*, T>::value, bool>
|
||||
std::enable_if_t<std::is_same_v<const char*, T>, bool>
|
||||
friend operator==(const config_attribute_value& val, T str)
|
||||
{
|
||||
return val.equals(std::string(str));
|
||||
|
|
|
@ -433,7 +433,7 @@ public:
|
|||
: container_(container)
|
||||
{
|
||||
// NOTE: add more conditions if this changes.
|
||||
static_assert((std::is_same<variant_vector, T>::value || std::is_same<variant_map_raw, T>::value),
|
||||
static_assert((std::is_same_v<variant_vector, T> || std::is_same_v<variant_map_raw, T>),
|
||||
"variant_container only accepts vector or map specifications.");
|
||||
}
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ public:
|
|||
, callback_load_value_(callback_load_value)
|
||||
, callback_save_value_(callback_save_value)
|
||||
{
|
||||
static_assert(!std::is_same<styled_widget, W>::value, "Second template argument cannot be styled_widget");
|
||||
static_assert(!std::is_same_v<styled_widget, W>, "Second template argument cannot be styled_widget");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,7 +308,7 @@ public:
|
|||
, callback_load_value_(nullptr)
|
||||
, callback_save_value_(nullptr)
|
||||
{
|
||||
static_assert(!std::is_same<styled_widget, W>::value, "Second template argument cannot be styled_widget");
|
||||
static_assert(!std::is_same_v<styled_widget, W>, "Second template argument cannot be styled_widget");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -335,7 +335,7 @@ public:
|
|||
, callback_load_value_(nullptr)
|
||||
, callback_save_value_(nullptr)
|
||||
{
|
||||
static_assert(std::is_same<styled_widget, W>::value, "Second template argument must be styled_widget");
|
||||
static_assert(std::is_same_v<styled_widget, W>, "Second template argument must be styled_widget");
|
||||
}
|
||||
|
||||
/** Inherited from field_base. */
|
||||
|
|
|
@ -57,7 +57,7 @@ struct dispatcher_implementation
|
|||
* dispatcher::signal_type<FUNCTION> \
|
||||
*/ \
|
||||
template<typename F> \
|
||||
static std::enable_if_t<std::is_same<F, FUNCTION>::value, dispatcher::signal_type<FUNCTION>>& \
|
||||
static std::enable_if_t<std::is_same_v<F, FUNCTION>, dispatcher::signal_type<FUNCTION>>& \
|
||||
event_signal(dispatcher& dispatcher, const ui_event event) \
|
||||
{ \
|
||||
return dispatcher.QUEUE.queue[event]; \
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace gui2
|
|||
* Default value getter for selectable widgets (like toggle buttons)
|
||||
*/
|
||||
template<typename T>
|
||||
static inline std::enable_if_t<std::is_base_of<selectable_item, T>::value, std::string>
|
||||
static inline std::enable_if_t<std::is_base_of_v<selectable_item, T>, std::string>
|
||||
default_status_value_getter(T& w)
|
||||
{
|
||||
return w.get_value_bool() ? _("yes") : _("no");
|
||||
|
@ -37,7 +37,7 @@ default_status_value_getter(T& w)
|
|||
* Default value getter for integer-based widgets (like sliders)
|
||||
*/
|
||||
template<typename T>
|
||||
static inline std::enable_if_t<std::is_base_of<integer_selector, T>::value, std::string>
|
||||
static inline std::enable_if_t<std::is_base_of_v<integer_selector, T>, std::string>
|
||||
default_status_value_getter(T& w)
|
||||
{
|
||||
return w.get_value_label();
|
||||
|
|
|
@ -32,11 +32,11 @@ struct builder_styled_widget;
|
|||
|
||||
/**
|
||||
* @ingroup GUIWidgetWML
|
||||
*
|
||||
*
|
||||
* Base class for all visible items.
|
||||
*
|
||||
*
|
||||
* All widgets placed in a cell of a grid have some values in common:
|
||||
* Key |Type |Default |Description
|
||||
* Key |Type |Default |Description
|
||||
* -----------------------------|------------------------------------|---------|-----------
|
||||
* id | @ref guivartype_string "string" |"" |This value is used for the engine to identify 'special' items. This means that for example a text_box can get the proper initial value. This value should be unique or empty. Those special values are documented at the window definition that uses them. NOTE: items starting with an underscore are used for composed widgets and these should be unique per composed widget.
|
||||
* definition | @ref guivartype_string "string" |"default"|The id of the widget definition to use. This way it's possible to select a specific version of the widget e.g. a title label when the label is used as title.
|
||||
|
@ -318,7 +318,7 @@ protected:
|
|||
template<typename T>
|
||||
std::shared_ptr<const typename T::resolution> cast_config_to() const
|
||||
{
|
||||
static_assert(std::is_base_of<resolution_definition, typename T::resolution>::value,
|
||||
static_assert(std::is_base_of_v<resolution_definition, typename T::resolution>,
|
||||
"Given type's resolution object does not derive from resolution_definition."
|
||||
);
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ struct lexical_caster<
|
|||
std::string
|
||||
, From
|
||||
, void
|
||||
, std::enable_if_t<std::is_integral<std::remove_pointer_t<From>>::value>
|
||||
, std::enable_if_t<std::is_integral_v<std::remove_pointer_t<From>>>
|
||||
>
|
||||
{
|
||||
std::string operator()(From value, std::optional<std::string>) const
|
||||
|
@ -192,7 +192,7 @@ struct lexical_caster<
|
|||
long long
|
||||
, From
|
||||
, void
|
||||
, std::enable_if_t<std::is_same<From, const char*>::value || std::is_same<From, char*>::value>
|
||||
, std::enable_if_t<std::is_same_v<From, const char*> || std::is_same_v<From, char*>>
|
||||
>
|
||||
{
|
||||
long long operator()(From value, std::optional<long long> fallback) const
|
||||
|
@ -247,8 +247,8 @@ template <class To, class From>
|
|||
struct lexical_caster<
|
||||
To
|
||||
, From
|
||||
, std::enable_if_t<std::is_integral<To>::value && std::is_signed<To>::value && !std::is_same<To, long long>::value>
|
||||
, std::enable_if_t<std::is_same<From, const char*>::value || std::is_same<From, char*>::value>
|
||||
, std::enable_if_t<std::is_integral_v<To> && std::is_signed_v<To> && !std::is_same_v<To, long long>>
|
||||
, std::enable_if_t<std::is_same_v<From, const char*> || std::is_same_v<From, char*>>
|
||||
>
|
||||
{
|
||||
To operator()(From value, std::optional<To> fallback) const
|
||||
|
@ -272,7 +272,7 @@ template <class To>
|
|||
struct lexical_caster<
|
||||
To
|
||||
, std::string
|
||||
, std::enable_if_t<std::is_integral<To>::value && std::is_signed<To>::value && !std::is_same<To, long long>::value>
|
||||
, std::enable_if_t<std::is_integral_v<To> && std::is_signed_v<To> && !std::is_same_v<To, long long>>
|
||||
>
|
||||
{
|
||||
To operator()(const std::string& value, std::optional<To> fallback) const
|
||||
|
@ -305,8 +305,8 @@ template <class To, class From>
|
|||
struct lexical_caster<
|
||||
To
|
||||
, From
|
||||
, std::enable_if_t<std::is_floating_point<To>::value>
|
||||
, std::enable_if_t<std::is_same<From, const char*>::value || std::is_same<From, char*>::value>
|
||||
, std::enable_if_t<std::is_floating_point_v<To>>
|
||||
, std::enable_if_t<std::is_same_v<From, const char*> || std::is_same_v<From, char*>>
|
||||
>
|
||||
{
|
||||
To operator()(From value, std::optional<To> fallback) const
|
||||
|
@ -330,7 +330,7 @@ template <class To>
|
|||
struct lexical_caster<
|
||||
To
|
||||
, std::string
|
||||
, std::enable_if_t<std::is_floating_point<To>::value>
|
||||
, std::enable_if_t<std::is_floating_point_v<To>>
|
||||
>
|
||||
{
|
||||
To operator()(const std::string& value, std::optional<To> fallback) const
|
||||
|
@ -375,7 +375,7 @@ struct lexical_caster<
|
|||
unsigned long long
|
||||
, From
|
||||
, void
|
||||
, std::enable_if_t<std::is_same<From, const char*>::value || std::is_same<From, char*>::value>
|
||||
, std::enable_if_t<std::is_same_v<From, const char*> || std::is_same_v<From, char*>>
|
||||
>
|
||||
{
|
||||
unsigned long long operator()(From value, std::optional<unsigned long long> fallback) const
|
||||
|
@ -431,8 +431,8 @@ template <class To, class From>
|
|||
struct lexical_caster<
|
||||
To
|
||||
, From
|
||||
, std::enable_if_t<std::is_unsigned<To>::value && !std::is_same<To, unsigned long long>::value>
|
||||
, std::enable_if_t<std::is_same<From, const char*>::value || std::is_same<From, char*>::value>
|
||||
, std::enable_if_t<std::is_unsigned_v<To> && !std::is_same_v<To, unsigned long long>>
|
||||
, std::enable_if_t<std::is_same_v<From, const char*> || std::is_same_v<From, char*>>
|
||||
>
|
||||
{
|
||||
To operator()(From value, std::optional<To> fallback) const
|
||||
|
@ -456,7 +456,7 @@ template <class To>
|
|||
struct lexical_caster<
|
||||
To
|
||||
, std::string
|
||||
, std::enable_if_t<std::is_unsigned<To>::value>
|
||||
, std::enable_if_t<std::is_unsigned_v<To>>
|
||||
>
|
||||
{
|
||||
To operator()(const std::string& value, std::optional<To> fallback) const
|
||||
|
|
|
@ -78,14 +78,14 @@ namespace lua_check_impl
|
|||
|
||||
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, lua_index_raw>::value, lua_index_raw>
|
||||
std::enable_if_t<std::is_same_v<T, lua_index_raw>, lua_index_raw>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
UNUSED(L);
|
||||
return lua_index_raw{ n };
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, lua_index_raw>::value, lua_index_raw>
|
||||
std::enable_if_t<std::is_same_v<T, lua_index_raw>, lua_index_raw>
|
||||
lua_to_or_default(lua_State *L, int n, const T& /*def*/)
|
||||
{
|
||||
UNUSED(L);
|
||||
|
@ -94,13 +94,13 @@ namespace lua_check_impl
|
|||
|
||||
//std::string
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, std::string>::value, std::string>
|
||||
std::enable_if_t<std::is_same_v<T, std::string>, std::string>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
return luaL_checkstring(L, n);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, std::string>::value, void>
|
||||
std::enable_if_t<std::is_same_v<T, std::string>, void>
|
||||
lua_push(lua_State *L, const T& val)
|
||||
{
|
||||
lua_pushlstring(L, val.c_str(), val.size());
|
||||
|
@ -108,19 +108,19 @@ namespace lua_check_impl
|
|||
|
||||
//utils::string_view
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, utils::string_view>::value, utils::string_view>
|
||||
std::enable_if_t<std::is_same_v<T, utils::string_view>, utils::string_view>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
return luaW_tostring(L, n);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, utils::string_view>::value, utils::string_view>
|
||||
std::enable_if_t<std::is_same_v<T, utils::string_view>, utils::string_view>
|
||||
lua_to_or_default(lua_State *L, int n, const T& def)
|
||||
{
|
||||
return luaW_tostring_or_default(L, n, def);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, utils::string_view>::value, void>
|
||||
std::enable_if_t<std::is_same_v<T, utils::string_view>, void>
|
||||
lua_push(lua_State *L, const T& val)
|
||||
{
|
||||
lua_pushlstring(L, val.data(), val.size());
|
||||
|
@ -128,13 +128,13 @@ namespace lua_check_impl
|
|||
|
||||
//config
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, config>::value, config>
|
||||
std::enable_if_t<std::is_same_v<T, config>, config>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
return luaW_checkconfig(L, n);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, config>::value, void>
|
||||
std::enable_if_t<std::is_same_v<T, config>, void>
|
||||
lua_push(lua_State *L, const config& val)
|
||||
{
|
||||
luaW_pushconfig(L, val);
|
||||
|
@ -142,13 +142,13 @@ namespace lua_check_impl
|
|||
|
||||
//location
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, map_location>::value, map_location>
|
||||
std::enable_if_t<std::is_same_v<T, map_location>, map_location>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
return luaW_checklocation(L, n);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, map_location>::value, map_location>
|
||||
std::enable_if_t<std::is_same_v<T, map_location>, map_location>
|
||||
lua_to_or_default(lua_State *L, int n, const T& def)
|
||||
{
|
||||
map_location res;
|
||||
|
@ -158,7 +158,7 @@ namespace lua_check_impl
|
|||
return res;
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, map_location>::value, void>
|
||||
std::enable_if_t<std::is_same_v<T, map_location>, void>
|
||||
lua_push(lua_State *L, const map_location& val)
|
||||
{
|
||||
luaW_pushlocation(L, val);
|
||||
|
@ -166,7 +166,7 @@ namespace lua_check_impl
|
|||
|
||||
//enums generated by MAKE_ENUM
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_base_of<enum_tag, T>::value, T>
|
||||
std::enable_if_t<std::is_base_of_v<enum_tag, T>, T>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
T val;
|
||||
|
@ -178,7 +178,7 @@ namespace lua_check_impl
|
|||
return val;
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_base_of<enum_tag, T>::value, T>
|
||||
std::enable_if_t<std::is_base_of_v<enum_tag, T>, T>
|
||||
lua_to_or_default(lua_State *L, int n, const T& def)
|
||||
{
|
||||
T val;
|
||||
|
@ -190,7 +190,7 @@ namespace lua_check_impl
|
|||
return val;
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_base_of<enum_tag, T>::value, void>
|
||||
std::enable_if_t<std::is_base_of_v<enum_tag, T>, void>
|
||||
lua_push(lua_State *L, T val)
|
||||
{
|
||||
lua_check_impl::lua_push(L, val.to_string());
|
||||
|
@ -198,13 +198,13 @@ namespace lua_check_impl
|
|||
|
||||
//t_string
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, t_string>::value, t_string>
|
||||
std::enable_if_t<std::is_same_v<T, t_string>, t_string>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
return luaW_checktstring(L, n);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, t_string>::value, void>
|
||||
std::enable_if_t<std::is_same_v<T, t_string>, void>
|
||||
lua_push(lua_State *L, const t_string& val)
|
||||
{
|
||||
luaW_pushtstring(L, val);
|
||||
|
@ -213,7 +213,7 @@ namespace lua_check_impl
|
|||
//widget
|
||||
//widget not suppored becasue lua_checek returns by value
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, gui2::widget>::value, void>
|
||||
std::enable_if_t<std::is_same_v<T, gui2::widget>, void>
|
||||
lua_push(lua_State *L, gui2::widget& val)
|
||||
{
|
||||
luaW_pushwidget(L, val);
|
||||
|
@ -221,19 +221,19 @@ namespace lua_check_impl
|
|||
|
||||
//bool
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, bool>::value, bool>
|
||||
std::enable_if_t<std::is_same_v<T, bool>, bool>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
return luaW_toboolean(L, n);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, bool>::value, bool>
|
||||
std::enable_if_t<std::is_same_v<T, bool>, bool>
|
||||
lua_to_or_default(lua_State *L, int n, const T& /*def*/)
|
||||
{
|
||||
return luaW_toboolean(L, n);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_same<T, bool>::value, void>
|
||||
std::enable_if_t<std::is_same_v<T, bool>, void>
|
||||
lua_push(lua_State *L, bool val)
|
||||
{
|
||||
lua_pushboolean(L, val);
|
||||
|
@ -241,13 +241,13 @@ namespace lua_check_impl
|
|||
|
||||
//double, float
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_floating_point<T>::value, T>
|
||||
std::enable_if_t<std::is_floating_point_v<T>, T>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
return luaL_checknumber(L, n);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_floating_point<T>::value, T>
|
||||
std::enable_if_t<std::is_floating_point_v<T>, T>
|
||||
lua_to_or_default(lua_State *L, int n, const T& def)
|
||||
{
|
||||
int isnum;
|
||||
|
@ -258,7 +258,7 @@ namespace lua_check_impl
|
|||
return d;
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_floating_point<T>::value, void>
|
||||
std::enable_if_t<std::is_floating_point_v<T>, void>
|
||||
lua_push(lua_State *L, T val)
|
||||
{
|
||||
lua_pushnumber(L, val);
|
||||
|
@ -266,13 +266,13 @@ namespace lua_check_impl
|
|||
|
||||
//integer types
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>
|
||||
std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>, T>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
return luaL_checkinteger(L, n);
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>
|
||||
std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>, T>
|
||||
lua_to_or_default(lua_State *L, int n, const T& def)
|
||||
{
|
||||
int isnum;
|
||||
|
@ -284,7 +284,7 @@ namespace lua_check_impl
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_integral<T>::value && !std::is_same<T, bool>::value, void>
|
||||
std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>, void>
|
||||
lua_push(lua_State *L, T val)
|
||||
{
|
||||
lua_pushnumber(L, val);
|
||||
|
@ -293,7 +293,7 @@ namespace lua_check_impl
|
|||
//std::pair
|
||||
//Not sure if the not_<is_const> is required; only (maybe) if std::map matches is_container
|
||||
template<typename T>
|
||||
std::enable_if_t<is_pair<T>::value && !std::is_const<typename T::first_type>::value, T>
|
||||
std::enable_if_t<is_pair<T>::value && !std::is_const_v<typename T::first_type>, T>
|
||||
lua_check(lua_State *L, int n)
|
||||
{
|
||||
T result;
|
||||
|
@ -307,7 +307,7 @@ namespace lua_check_impl
|
|||
return result;
|
||||
}
|
||||
template<typename T>
|
||||
std::enable_if_t<is_pair<T>::value && !std::is_const<typename T::first_type>::value, void>
|
||||
std::enable_if_t<is_pair<T>::value && !std::is_const_v<typename T::first_type>, void>
|
||||
lua_push(lua_State *L, const T& val)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
@ -319,7 +319,7 @@ namespace lua_check_impl
|
|||
|
||||
//std::vector and similar but not std::string
|
||||
template<typename T>
|
||||
std::enable_if_t<is_container<T>::value && !std::is_same<T, std::string>::value && !std::is_same<T, utils::string_view>::value, T>
|
||||
std::enable_if_t<is_container<T>::value && !std::is_same_v<T, std::string> && !std::is_same_v<T, utils::string_view>, T>
|
||||
lua_check(lua_State * L, int n)
|
||||
{
|
||||
if (lua_istable(L, n))
|
||||
|
@ -350,7 +350,7 @@ namespace lua_check_impl
|
|||
//also accepts things like std::vector<int>() | std::adaptors::transformed(..)
|
||||
template<typename T>
|
||||
std::enable_if_t<
|
||||
is_container<T>::value && !std::is_same<T, std::string>::value && !std::is_same<T, utils::string_view>::value && !is_map<T>::value
|
||||
is_container<T>::value && !std::is_same_v<T, std::string> && !std::is_same_v<T, utils::string_view> && !is_map<T>::value
|
||||
, void
|
||||
>
|
||||
lua_push(lua_State * L, const T& list )
|
||||
|
|
|
@ -1155,7 +1155,7 @@ public:
|
|||
struct upkeep_type_visitor : public boost::static_visitor<std::string>
|
||||
{
|
||||
template<typename T>
|
||||
std::enable_if_t<!std::is_same<int, T>::value, std::string>
|
||||
std::enable_if_t<!std::is_same_v<int, T>, std::string>
|
||||
operator()(T&) const
|
||||
{
|
||||
// Any special upkeep type should have an associated @ref type getter in its helper struct.
|
||||
|
@ -1175,7 +1175,7 @@ public:
|
|||
{
|
||||
public:
|
||||
template<typename N>
|
||||
std::enable_if_t<std::is_arithmetic<N>::value, upkeep_t>
|
||||
std::enable_if_t<std::is_arithmetic_v<N>, upkeep_t>
|
||||
operator()(N n) const
|
||||
{
|
||||
if(n == 0) return upkeep_loyal();
|
||||
|
@ -1184,7 +1184,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename B>
|
||||
std::enable_if_t<std::is_convertible<B, bool>::value && !std::is_arithmetic<B>::value, upkeep_t>
|
||||
std::enable_if_t<std::is_convertible_v<B, bool> && !std::is_arithmetic_v<B>, upkeep_t>
|
||||
operator()(B b) const
|
||||
{
|
||||
throw std::invalid_argument(b.str());
|
||||
|
|
|
@ -36,11 +36,11 @@ template<typename D, typename S>
|
|||
struct const_clone
|
||||
{
|
||||
static const bool is_source_const =
|
||||
std::is_const<
|
||||
std::is_const_v<
|
||||
std::remove_pointer_t<
|
||||
std::remove_reference_t<S>
|
||||
>
|
||||
>::value;
|
||||
>;
|
||||
|
||||
/** The destination type, possibly const qualified. */
|
||||
using type =
|
||||
|
|
|
@ -98,8 +98,8 @@ public:
|
|||
variable_info_mutable(const std::string& name, config& game_vars)
|
||||
: variable_info<V>(name, game_vars)
|
||||
{
|
||||
static_assert(!std::is_same<
|
||||
variable_info_implementation::vi_policy_const, std::remove_const_t<V>>::value,
|
||||
static_assert(!std::is_same_v<
|
||||
variable_info_implementation::vi_policy_const, std::remove_const_t<V>>,
|
||||
"variable_info_mutable cannot be specialized with 'vi_policy_const'"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue