mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 03:45:30 +07:00
rename uvalue::is_valid to has_value
This commit is contained in:
@@ -2907,7 +2907,7 @@ namespace meta_hpp
|
|||||||
&& std::is_constructible_v<Tp, std::initializer_list<U>&, Args...> //
|
&& std::is_constructible_v<Tp, std::initializer_list<U>&, Args...> //
|
||||||
Tp& emplace(std::initializer_list<U> ilist, Args&&... args);
|
Tp& emplace(std::initializer_list<U> ilist, Args&&... args);
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool has_value() const noexcept;
|
||||||
[[nodiscard]] explicit operator bool() const noexcept;
|
[[nodiscard]] explicit operator bool() const noexcept;
|
||||||
|
|
||||||
void reset() noexcept;
|
void reset() noexcept;
|
||||||
@@ -8764,12 +8764,12 @@ namespace meta_hpp
|
|||||||
return vtable_t::do_ctor<T>(*this, ilist, std::forward<Args>(args)...);
|
return vtable_t::do_ctor<T>(*this, ilist, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool uvalue::is_valid() const noexcept {
|
inline bool uvalue::has_value() const noexcept {
|
||||||
return storage_.vtag != 0;
|
return storage_.vtag != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uvalue::operator bool() const noexcept {
|
inline uvalue::operator bool() const noexcept {
|
||||||
return is_valid();
|
return has_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void uvalue::reset() noexcept {
|
inline void uvalue::reset() noexcept {
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ TEST_CASE("meta/meta_utilities/value") {
|
|||||||
CHECK(!val);
|
CHECK(!val);
|
||||||
CHECK_FALSE(val);
|
CHECK_FALSE(val);
|
||||||
|
|
||||||
CHECK_FALSE(val.is_valid());
|
CHECK_FALSE(val.has_value());
|
||||||
CHECK(val.get_data() == nullptr);
|
CHECK(val.get_data() == nullptr);
|
||||||
CHECK(std::as_const(val).get_data() == nullptr);
|
CHECK(std::as_const(val).get_data() == nullptr);
|
||||||
CHECK(std::as_const(val).get_cdata() == nullptr);
|
CHECK(std::as_const(val).get_cdata() == nullptr);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace meta_hpp
|
|||||||
&& std::is_constructible_v<Tp, std::initializer_list<U>&, Args...> //
|
&& std::is_constructible_v<Tp, std::initializer_list<U>&, Args...> //
|
||||||
Tp& emplace(std::initializer_list<U> ilist, Args&&... args);
|
Tp& emplace(std::initializer_list<U> ilist, Args&&... args);
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool has_value() const noexcept;
|
||||||
[[nodiscard]] explicit operator bool() const noexcept;
|
[[nodiscard]] explicit operator bool() const noexcept;
|
||||||
|
|
||||||
void reset() noexcept;
|
void reset() noexcept;
|
||||||
|
|||||||
@@ -330,12 +330,12 @@ namespace meta_hpp
|
|||||||
return vtable_t::do_ctor<T>(*this, ilist, std::forward<Args>(args)...);
|
return vtable_t::do_ctor<T>(*this, ilist, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool uvalue::is_valid() const noexcept {
|
inline bool uvalue::has_value() const noexcept {
|
||||||
return storage_.vtag != 0;
|
return storage_.vtag != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uvalue::operator bool() const noexcept {
|
inline uvalue::operator bool() const noexcept {
|
||||||
return is_valid();
|
return has_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void uvalue::reset() noexcept {
|
inline void uvalue::reset() noexcept {
|
||||||
|
|||||||
Reference in New Issue
Block a user