stl: std::declval
This commit is contained in:
@@ -61,8 +61,8 @@ class dense_map_iterator final {
|
||||
friend class dense_map_iterator;
|
||||
|
||||
static_assert(std::is_pointer_v<It>, "Not a pointer type");
|
||||
using first_type = decltype(std::as_const(std::declval<It>()->element.first));
|
||||
using second_type = decltype((std::declval<It>()->element.second));
|
||||
using first_type = decltype(std::as_const(stl::declval<It>()->element.first));
|
||||
using second_type = decltype((stl::declval<It>()->element.second));
|
||||
|
||||
public:
|
||||
using value_type = std::pair<first_type, second_type>;
|
||||
@@ -156,8 +156,8 @@ class dense_map_local_iterator final {
|
||||
friend class dense_map_local_iterator;
|
||||
|
||||
static_assert(std::is_pointer_v<It>, "Not a pointer type");
|
||||
using first_type = decltype(std::as_const(std::declval<It>()->element.first));
|
||||
using second_type = decltype((std::declval<It>()->element.second));
|
||||
using first_type = decltype(std::as_const(stl::declval<It>()->element.first));
|
||||
using second_type = decltype((stl::declval<It>()->element.second));
|
||||
|
||||
public:
|
||||
using value_type = std::pair<first_type, second_type>;
|
||||
|
||||
@@ -21,7 +21,7 @@ class table_iterator {
|
||||
friend class table_iterator;
|
||||
|
||||
public:
|
||||
using value_type = decltype(stl::forward_as_tuple(*std::declval<It>()...));
|
||||
using value_type = decltype(stl::forward_as_tuple(*stl::declval<It>()...));
|
||||
using pointer = input_iterator_pointer<value_type>;
|
||||
using reference = value_type;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
|
||||
@@ -67,13 +67,13 @@ struct forward_apply: private Func {
|
||||
* @return Return value of the underlying function, if any.
|
||||
*/
|
||||
template<typename Type>
|
||||
constexpr decltype(auto) operator()(Type &&args) noexcept(noexcept(stl::apply(std::declval<Func &>(), args))) {
|
||||
constexpr decltype(auto) operator()(Type &&args) noexcept(noexcept(stl::apply(stl::declval<Func &>(), args))) {
|
||||
return stl::apply(static_cast<Func &>(*this), std::forward<Type>(args));
|
||||
}
|
||||
|
||||
/*! @copydoc operator()() */
|
||||
template<typename Type>
|
||||
constexpr decltype(auto) operator()(Type &&args) const noexcept(noexcept(stl::apply(std::declval<const Func &>(), args))) {
|
||||
constexpr decltype(auto) operator()(Type &&args) const noexcept(noexcept(stl::apply(stl::declval<const Func &>(), args))) {
|
||||
return stl::apply(static_cast<const Func &>(*this), std::forward<Type>(args));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -750,7 +750,7 @@ template<typename>
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
[[nodiscard]] ENTT_CONSTEVAL auto maybe_equality_comparable(int) -> decltype(std::declval<Type>() == std::declval<Type>()) {
|
||||
[[nodiscard]] ENTT_CONSTEVAL auto maybe_equality_comparable(int) -> decltype(stl::declval<Type>() == stl::declval<Type>()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -844,7 +844,7 @@ class member_class {
|
||||
|
||||
public:
|
||||
/*! @brief The class of the given non-static member object or function. */
|
||||
using type = std::remove_pointer_t<decltype(clazz(std::declval<Member>()))>;
|
||||
using type = std::remove_pointer_t<decltype(clazz(stl::declval<Member>()))>;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -878,7 +878,7 @@ class nth_argument {
|
||||
|
||||
public:
|
||||
/*! @brief N-th argument of the _callable_ type. */
|
||||
using type = type_list_element_t<Index, decltype(pick_up(std::declval<Candidate>()))>;
|
||||
using type = type_list_element_t<Index, decltype(pick_up(stl::declval<Candidate>()))>;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ class extended_group_iterator<It, owned_t<Owned...>, get_t<Get...>> {
|
||||
|
||||
public:
|
||||
using iterator_type = It;
|
||||
using value_type = decltype(stl::tuple_cat(stl::make_tuple(*std::declval<It>()), std::declval<Owned>().get_as_tuple({})..., std::declval<Get>().get_as_tuple({})...));
|
||||
using value_type = decltype(stl::tuple_cat(stl::make_tuple(*stl::declval<It>()), stl::declval<Owned>().get_as_tuple({})..., stl::declval<Get>().get_as_tuple({})...));
|
||||
using pointer = input_iterator_pointer<value_type>;
|
||||
using reference = value_type;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
@@ -536,7 +536,7 @@ public:
|
||||
template<typename Func>
|
||||
void each(Func func) const {
|
||||
for(const auto entt: *this) {
|
||||
if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, std::declval<basic_group>().get({})))>) {
|
||||
if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, stl::declval<basic_group>().get({})))>) {
|
||||
stl::apply(func, stl::tuple_cat(stl::make_tuple(entt), get(entt)));
|
||||
} else {
|
||||
stl::apply(func, get(entt));
|
||||
@@ -935,7 +935,7 @@ public:
|
||||
template<typename Func>
|
||||
void each(Func func) const {
|
||||
for(auto args: each()) {
|
||||
if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, std::declval<basic_group>().get({})))>) {
|
||||
if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, stl::declval<basic_group>().get({})))>) {
|
||||
stl::apply(func, args);
|
||||
} else {
|
||||
stl::apply([&func](auto, auto &&...less) { func(std::forward<decltype(less)>(less)...); }, args);
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
/*! @brief Unsigned integer type. */
|
||||
using size_type = std::size_t;
|
||||
/*! @brief Iterable handle type. */
|
||||
using iterable = iterable_adaptor<internal::handle_storage_iterator<typename decltype(std::declval<registry_type>().storage())::iterator>>;
|
||||
using iterable = iterable_adaptor<internal::handle_storage_iterator<typename decltype(stl::declval<registry_type>().storage())::iterator>>;
|
||||
|
||||
/*! @brief Constructs an invalid handle. */
|
||||
basic_handle() noexcept
|
||||
|
||||
@@ -41,7 +41,7 @@ class registry_storage_iterator final {
|
||||
template<typename>
|
||||
friend class registry_storage_iterator;
|
||||
|
||||
using mapped_type = std::remove_reference_t<decltype(std::declval<It>()->second)>;
|
||||
using mapped_type = std::remove_reference_t<decltype(stl::declval<It>()->second)>;
|
||||
|
||||
public:
|
||||
using value_type = std::pair<id_type, constness_as_t<typename mapped_type::element_type, mapped_type> &>;
|
||||
|
||||
@@ -139,7 +139,7 @@ class extended_storage_iterator final {
|
||||
|
||||
public:
|
||||
using iterator_type = It;
|
||||
using value_type = decltype(stl::tuple_cat(stl::make_tuple(*std::declval<It>()), stl::forward_as_tuple(*std::declval<Other>()...)));
|
||||
using value_type = decltype(stl::tuple_cat(stl::make_tuple(*stl::declval<It>()), stl::forward_as_tuple(*stl::declval<Other>()...)));
|
||||
using pointer = input_iterator_pointer<value_type>;
|
||||
using reference = value_type;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
|
||||
@@ -131,7 +131,7 @@ private:
|
||||
template<typename It, typename... Get>
|
||||
struct extended_view_iterator final {
|
||||
using iterator_type = It;
|
||||
using value_type = decltype(stl::tuple_cat(stl::make_tuple(*std::declval<It>()), std::declval<Get>().get_as_tuple({})...));
|
||||
using value_type = decltype(stl::tuple_cat(stl::make_tuple(*stl::declval<It>()), stl::declval<Get>().get_as_tuple({})...));
|
||||
using pointer = input_iterator_pointer<value_type>;
|
||||
using reference = value_type;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
@@ -430,7 +430,7 @@ class basic_view<get_t<Get...>, exclude_t<Exclude...>>
|
||||
void each(Func func, std::index_sequence<Index...>) const {
|
||||
for(const auto curr: storage<Curr>()->each()) {
|
||||
if(const auto entt = std::get<0>(curr); (!internal::tombstone_check_v<Get...> || (entt != tombstone)) && ((Curr == Index || base_type::pool_at(Index)->contains(entt)) && ...) && base_type::none_of(entt)) {
|
||||
if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, std::declval<basic_view>().get({})))>) {
|
||||
if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, stl::declval<basic_view>().get({})))>) {
|
||||
stl::apply(func, stl::tuple_cat(stl::make_tuple(entt), dispatch_get<Curr, Index>(curr)...));
|
||||
} else {
|
||||
stl::apply(func, stl::tuple_cat(dispatch_get<Curr, Index>(curr)...));
|
||||
@@ -918,7 +918,7 @@ public:
|
||||
/*! @brief Reverse iterator type. */
|
||||
using reverse_iterator = base_type::reverse_iterator;
|
||||
/*! @brief Iterable view type. */
|
||||
using iterable = std::conditional_t<Get::storage_policy == deletion_policy::in_place, iterable_adaptor<internal::extended_view_iterator<iterator, Get>>, decltype(std::declval<Get>().each())>;
|
||||
using iterable = std::conditional_t<Get::storage_policy == deletion_policy::in_place, iterable_adaptor<internal::extended_view_iterator<iterator, Get>>, decltype(stl::declval<Get>().each())>;
|
||||
|
||||
/*! @brief Default constructor to use to create empty, invalid views. */
|
||||
basic_view() noexcept
|
||||
@@ -1053,7 +1053,7 @@ public:
|
||||
*/
|
||||
template<typename Func>
|
||||
void each(Func func) const {
|
||||
if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, std::declval<basic_view>().get({})))>) {
|
||||
if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, stl::declval<basic_view>().get({})))>) {
|
||||
for(const auto pack: each()) {
|
||||
stl::apply(func, pack);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ concept meta_associative_container_like = requires(Type value) {
|
||||
requires entt::stl::forward_iterator<typename Type::iterator>;
|
||||
{ value.begin() } -> std::same_as<typename Type::iterator>;
|
||||
{ value.end() } -> std::same_as<typename Type::iterator>;
|
||||
value.find(std::declval<typename Type::key_type>());
|
||||
value.find(stl::declval<typename Type::key_type>());
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
@@ -187,10 +187,10 @@ class meta_any {
|
||||
if constexpr(!std::is_void_v<std::remove_const_t<typename std::pointer_traits<Type>::element_type>>) {
|
||||
if constexpr(std::is_constructible_v<bool, Type>) {
|
||||
if(const auto &pointer_like = any_cast<const Type &>(value.storage); pointer_like) {
|
||||
static_cast<meta_any *>(other)->emplace<decltype(adl_meta_pointer_like<Type>::dereference(std::declval<const Type &>()))>(adl_meta_pointer_like<Type>::dereference(pointer_like));
|
||||
static_cast<meta_any *>(other)->emplace<decltype(adl_meta_pointer_like<Type>::dereference(stl::declval<const Type &>()))>(adl_meta_pointer_like<Type>::dereference(pointer_like));
|
||||
}
|
||||
} else {
|
||||
static_cast<meta_any *>(other)->emplace<decltype(adl_meta_pointer_like<Type>::dereference(std::declval<const Type &>()))>(adl_meta_pointer_like<Type>::dereference(any_cast<const Type &>(value.storage)));
|
||||
static_cast<meta_any *>(other)->emplace<decltype(adl_meta_pointer_like<Type>::dereference(stl::declval<const Type &>()))>(adl_meta_pointer_like<Type>::dereference(any_cast<const Type &>(value.storage)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ class meta_function_helper {
|
||||
|
||||
public:
|
||||
/*! @brief The meta function descriptor of the given function. */
|
||||
using type = decltype(get_rid_of_noexcept(std::declval<Candidate>()));
|
||||
using type = decltype(get_rid_of_noexcept(stl::declval<Candidate>()));
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,7 +77,7 @@ class poly_vtable {
|
||||
if constexpr(sizeof...(Func) == 0u) {
|
||||
return decltype(make_vtable(typename Concept::template impl<inspector>{})){};
|
||||
} else if constexpr((std::is_function_v<Func> && ...)) {
|
||||
return decltype(stl::make_tuple(vtable_entry(std::declval<Func inspector::*>())...)){};
|
||||
return decltype(stl::make_tuple(vtable_entry(stl::declval<Func inspector::*>())...)){};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ requires stl::is_member_object_pointer_v<Type Class::*>
|
||||
auto function_pointer(Type Class::*, Other &&...) -> Type (*)();
|
||||
|
||||
template<typename... Type>
|
||||
using function_pointer_t = decltype(function_pointer(std::declval<Type>()...));
|
||||
using function_pointer_t = decltype(function_pointer(stl::declval<Type>()...));
|
||||
|
||||
template<typename... Class, typename Ret, typename... Args>
|
||||
[[nodiscard]] ENTT_CONSTEVAL auto index_sequence_for(Ret (*)(Args...)) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
/*! @cond ENTT_INTERNAL */
|
||||
namespace entt::stl {
|
||||
|
||||
using std::declval;
|
||||
using std::exchange;
|
||||
|
||||
} // namespace entt::stl
|
||||
|
||||
Reference in New Issue
Block a user