Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions source/tinystl/type_traits/is_arithmetic.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
namespace tinystl {
template <class T>
struct is_arithmetic
: integral_constant<
bool, is_integral<T>::value || is_floating_point<T>::value> {};
: bool_constant<is_integral_v<T> || is_floating_point_v<T>> {};

template <class T>
inline constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
Expand Down
2 changes: 1 addition & 1 deletion source/tinystl/type_traits/is_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace detail {
template <class T>
tinystl::integral_constant<bool, !tinystl::is_union<T>::value> test(int T::*);
tinystl::bool_constant<!tinystl::is_union_v<T>> test(int T::*);

template <class>
tinystl::false_type test(...);
Expand Down
11 changes: 5 additions & 6 deletions source/tinystl/type_traits/is_floating_point.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#pragma once

#include "tinystl/type_traits/remove_cv.h"
#include "tinystl/type_traits/integral_constant.h"
#include "tinystl/type_traits/is_same.h"
#include "tinystl/type_traits/remove_cv.h"

namespace tinystl {
template <class T>
struct is_floating_point
: integral_constant<
bool,
: bool_constant<
// Note: standard floating-point types
is_same<float, typename remove_cv<T>::type>::value ||
is_same<double, typename remove_cv<T>::type>::value ||
is_same<long double, typename remove_cv<T>::type>::value> {};
is_same_v<float, remove_cv_t<T>> ||
is_same_v<double, remove_cv_t<T>> ||
is_same_v<long double, remove_cv_t<T>>> {};

template <class T>
inline constexpr bool is_floating_point_v = is_floating_point<T>::value;
Expand Down
2 changes: 1 addition & 1 deletion source/tinystl/type_traits/is_member_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct is_member_pointer_helper<T U::*> : true_type {};

template <class T>
struct is_member_pointer
: is_member_pointer_helper<typename remove_cv<T>::type> {};
: is_member_pointer_helper<remove_cv_t<T>> {};

template <class T>
inline constexpr bool is_member_pointer_v = is_member_pointer<T>::value;
Expand Down
2 changes: 1 addition & 1 deletion source/tinystl/type_traits/is_null_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace tinystl {
template <class T>
struct is_null_pointer : is_same<std::nullptr_t, typename remove_cv<T>::type> {
struct is_null_pointer : is_same<std::nullptr_t, remove_cv_t<T>> {
};

template <class T>
Expand Down
8 changes: 4 additions & 4 deletions source/tinystl/type_traits/is_object.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#pragma once

#include "tinystl/type_traits/is_scalar.h"
#include "tinystl/type_traits/integral_constant.h"
#include "tinystl/type_traits/is_array.h"
#include "tinystl/type_traits/is_class.h"
#include "tinystl/type_traits/is_scalar.h"
#include "tinystl/type_traits/is_union.h"

namespace tinystl {
// https://en.cppreference.com/w/cpp/types/is_object.html
template <class T>
struct is_object : integral_constant<
bool, is_scalar<T>::value || is_array<T>::value ||
is_union<T>::value || is_class<T>::value> {};
struct is_object
: bool_constant<
is_scalar_v<T> || is_array_v<T> || is_union_v<T> || is_class_v<T>> {};

template <class T>
inline constexpr bool is_object_v = is_object<T>::value;
Expand Down
2 changes: 1 addition & 1 deletion source/tinystl/type_traits/is_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace tinystl {
template<class T>
struct is_reference : bool_constant<is_lvalue_reference<T>::value || is_rvalue_reference<T>::value> {};
struct is_reference : bool_constant<is_lvalue_reference_v<T> || is_rvalue_reference_v<T>> {};

template <class T>
inline constexpr bool is_reference_v = is_reference<T>::value;
Expand Down
12 changes: 5 additions & 7 deletions source/tinystl/type_traits/is_scalar.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
#pragma once

#include "tinystl/type_traits/is_arithmetic.h"
#include "tinystl/type_traits/is_member_pointer.h"
#include "tinystl/type_traits/integral_constant.h"
#include "tinystl/type_traits/is_arithmetic.h"
#include "tinystl/type_traits/is_enum.h"
#include "tinystl/type_traits/is_member_pointer.h"
#include "tinystl/type_traits/is_null_pointer.h"
#include "tinystl/type_traits/is_pointer.h"

namespace tinystl {
// https://en.cppreference.com/w/cpp/types/is_scalar
template <class T>
struct is_scalar
: integral_constant<
bool, is_arithmetic<T>::value || is_enum<T>::value ||
is_pointer<T>::value || is_member_pointer<T>::value ||
is_null_pointer<T>::value> {};
struct is_scalar : bool_constant<
is_arithmetic_v<T> || is_enum_v<T> || is_pointer_v<T> ||
is_member_pointer_v<T> || is_null_pointer_v<T>> {};

template <class T>
inline constexpr bool is_scalar_v = is_scalar<T>::value;
Expand Down
2 changes: 1 addition & 1 deletion source/tinystl/type_traits/is_void.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace tinystl {

// https://en.cppreference.com/w/cpp/types/is_void.html
template <class T>
struct is_void : is_same<void, typename remove_cv<T>::type> {};
struct is_void : is_same<void, remove_cv_t<T>> {};

template <class T>
inline constexpr bool is_void_v = is_void<T>::value;
Expand Down
Loading