mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-02-14 22:29:57 +08:00
remove existing constexpr
This commit is contained in:
parent
f753961ab7
commit
ef333e491a
@ -94,7 +94,7 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Common_Types get_common_type(size_t t_size, bool t_signed)
|
static Common_Types get_common_type(size_t t_size, bool t_signed)
|
||||||
{
|
{
|
||||||
return (t_size == 1 && t_signed)?(Common_Types::t_int8)
|
return (t_size == 1 && t_signed)?(Common_Types::t_int8)
|
||||||
:(t_size == 1)?(Common_Types::t_uint8)
|
:(t_size == 1)?(Common_Types::t_uint8)
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace chaiscript
|
|||||||
class Type_Info
|
class Type_Info
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
constexpr Type_Info(const bool t_is_const, const bool t_is_reference, const bool t_is_pointer, const bool t_is_void,
|
Type_Info(const bool t_is_const, const bool t_is_reference, const bool t_is_pointer, const bool t_is_void,
|
||||||
const bool t_is_arithmetic, const std::type_info *t_ti, const std::type_info *t_bare_ti)
|
const bool t_is_arithmetic, const std::type_info *t_ti, const std::type_info *t_bare_ti)
|
||||||
: m_type_info(t_ti), m_bare_type_info(t_bare_ti),
|
: m_type_info(t_ti), m_bare_type_info(t_bare_ti),
|
||||||
m_flags((static_cast<unsigned int>(t_is_const) << is_const_flag)
|
m_flags((static_cast<unsigned int>(t_is_const) << is_const_flag)
|
||||||
@ -44,51 +44,51 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Type_Info() = default;
|
Type_Info() = default;
|
||||||
|
|
||||||
constexpr bool operator<(const Type_Info &ti) const noexcept
|
bool operator<(const Type_Info &ti) const noexcept
|
||||||
{
|
{
|
||||||
return m_type_info < ti.m_type_info;
|
return m_type_info < ti.m_type_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator!=(const Type_Info &ti) const noexcept
|
bool operator!=(const Type_Info &ti) const noexcept
|
||||||
{
|
{
|
||||||
return !(operator==(ti));
|
return !(operator==(ti));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator!=(const std::type_info &ti) const noexcept
|
bool operator!=(const std::type_info &ti) const noexcept
|
||||||
{
|
{
|
||||||
return !(operator==(ti));
|
return !(operator==(ti));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator==(const Type_Info &ti) const noexcept
|
bool operator==(const Type_Info &ti) const noexcept
|
||||||
{
|
{
|
||||||
return ti.m_type_info == m_type_info
|
return ti.m_type_info == m_type_info
|
||||||
|| *ti.m_type_info == *m_type_info;
|
|| *ti.m_type_info == *m_type_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator==(const std::type_info &ti) const noexcept
|
bool operator==(const std::type_info &ti) const noexcept
|
||||||
{
|
{
|
||||||
return !is_undef() && (*m_type_info) == ti;
|
return !is_undef() && (*m_type_info) == ti;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool bare_equal(const Type_Info &ti) const noexcept
|
bool bare_equal(const Type_Info &ti) const noexcept
|
||||||
{
|
{
|
||||||
return ti.m_bare_type_info == m_bare_type_info
|
return ti.m_bare_type_info == m_bare_type_info
|
||||||
|| *ti.m_bare_type_info == *m_bare_type_info;
|
|| *ti.m_bare_type_info == *m_bare_type_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool bare_equal_type_info(const std::type_info &ti) const noexcept
|
bool bare_equal_type_info(const std::type_info &ti) const noexcept
|
||||||
{
|
{
|
||||||
return !is_undef() && (*m_bare_type_info) == ti;
|
return !is_undef() && (*m_bare_type_info) == ti;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool is_const() const noexcept { return (m_flags & (1 << is_const_flag)) != 0; }
|
bool is_const() const noexcept { return (m_flags & (1 << is_const_flag)) != 0; }
|
||||||
constexpr bool is_reference() const noexcept { return (m_flags & (1 << is_reference_flag)) != 0; }
|
bool is_reference() const noexcept { return (m_flags & (1 << is_reference_flag)) != 0; }
|
||||||
constexpr bool is_void() const noexcept { return (m_flags & (1 << is_void_flag)) != 0; }
|
bool is_void() const noexcept { return (m_flags & (1 << is_void_flag)) != 0; }
|
||||||
constexpr bool is_arithmetic() const noexcept { return (m_flags & (1 << is_arithmetic_flag)) != 0; }
|
bool is_arithmetic() const noexcept { return (m_flags & (1 << is_arithmetic_flag)) != 0; }
|
||||||
constexpr bool is_undef() const noexcept { return (m_flags & (1 << is_undef_flag)) != 0; }
|
bool is_undef() const noexcept { return (m_flags & (1 << is_undef_flag)) != 0; }
|
||||||
constexpr bool is_pointer() const noexcept { return (m_flags & (1 << is_pointer_flag)) != 0; }
|
bool is_pointer() const noexcept { return (m_flags & (1 << is_pointer_flag)) != 0; }
|
||||||
|
|
||||||
std::string name() const
|
std::string name() const
|
||||||
{
|
{
|
||||||
@ -110,7 +110,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const std::type_info *bare_type_info() const
|
const std::type_info *bare_type_info() const
|
||||||
{
|
{
|
||||||
return m_bare_type_info;
|
return m_bare_type_info;
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ namespace chaiscript
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct Get_Type_Info
|
struct Get_Type_Info
|
||||||
{
|
{
|
||||||
static constexpr Type_Info get()
|
static Type_Info get()
|
||||||
{
|
{
|
||||||
return Type_Info(std::is_const<typename std::remove_pointer<typename std::remove_reference<T>::type>::type>::value,
|
return Type_Info(std::is_const<typename std::remove_pointer<typename std::remove_reference<T>::type>::type>::value,
|
||||||
std::is_reference<T>::value, std::is_pointer<T>::value,
|
std::is_reference<T>::value, std::is_pointer<T>::value,
|
||||||
@ -152,7 +152,7 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
// typedef T type;
|
// typedef T type;
|
||||||
|
|
||||||
static constexpr Type_Info get()
|
static Type_Info get()
|
||||||
{
|
{
|
||||||
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
|
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
|
||||||
std::is_void<T>::value,
|
std::is_void<T>::value,
|
||||||
@ -170,7 +170,7 @@ namespace chaiscript
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct Get_Type_Info<const std::shared_ptr<T> &>
|
struct Get_Type_Info<const std::shared_ptr<T> &>
|
||||||
{
|
{
|
||||||
static constexpr Type_Info get()
|
static Type_Info get()
|
||||||
{
|
{
|
||||||
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
|
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
|
||||||
std::is_void<T>::value,
|
std::is_void<T>::value,
|
||||||
@ -183,7 +183,7 @@ namespace chaiscript
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct Get_Type_Info<std::reference_wrapper<T> >
|
struct Get_Type_Info<std::reference_wrapper<T> >
|
||||||
{
|
{
|
||||||
static constexpr Type_Info get()
|
static Type_Info get()
|
||||||
{
|
{
|
||||||
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
|
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
|
||||||
std::is_void<T>::value,
|
std::is_void<T>::value,
|
||||||
@ -196,7 +196,7 @@ namespace chaiscript
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct Get_Type_Info<const std::reference_wrapper<T> &>
|
struct Get_Type_Info<const std::reference_wrapper<T> &>
|
||||||
{
|
{
|
||||||
static constexpr Type_Info get()
|
static Type_Info get()
|
||||||
{
|
{
|
||||||
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
|
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
|
||||||
std::is_void<T>::value,
|
std::is_void<T>::value,
|
||||||
@ -218,7 +218,7 @@ namespace chaiscript
|
|||||||
/// chaiscript::Type_Info ti = chaiscript::user_type(i);
|
/// chaiscript::Type_Info ti = chaiscript::user_type(i);
|
||||||
/// \endcode
|
/// \endcode
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr Type_Info user_type(const T &/*t*/)
|
Type_Info user_type(const T &/*t*/)
|
||||||
{
|
{
|
||||||
return detail::Get_Type_Info<T>::get();
|
return detail::Get_Type_Info<T>::get();
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ namespace chaiscript
|
|||||||
/// chaiscript::Type_Info ti = chaiscript::user_type<int>();
|
/// chaiscript::Type_Info ti = chaiscript::user_type<int>();
|
||||||
/// \endcode
|
/// \endcode
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr Type_Info user_type()
|
Type_Info user_type()
|
||||||
{
|
{
|
||||||
return detail::Get_Type_Info<T>::get();
|
return detail::Get_Type_Info<T>::get();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2286,7 +2286,7 @@ namespace chaiscript
|
|||||||
bool Prefix() {
|
bool Prefix() {
|
||||||
const auto prev_stack_top = m_match_stack.size();
|
const auto prev_stack_top = m_match_stack.size();
|
||||||
using SS = utility::Static_String;
|
using SS = utility::Static_String;
|
||||||
constexpr const std::array<utility::Static_String, 6> prefix_opers{{
|
const std::array<utility::Static_String, 6> prefix_opers{{
|
||||||
SS{"++"},
|
SS{"++"},
|
||||||
SS{"--"},
|
SS{"--"},
|
||||||
SS{"-"},
|
SS{"-"},
|
||||||
|
|||||||
@ -15,16 +15,16 @@ namespace chaiscript
|
|||||||
struct Static_String
|
struct Static_String
|
||||||
{
|
{
|
||||||
template<size_t N>
|
template<size_t N>
|
||||||
constexpr Static_String(const char (&str)[N])
|
Static_String(const char (&str)[N])
|
||||||
: m_size(N-1), data(&str[0])
|
: m_size(N-1), data(&str[0])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr size_t size() const {
|
size_t size() const {
|
||||||
return m_size;
|
return m_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const char *c_str() const {
|
const char *c_str() const {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user