Changeset ee51635 in mainline


Ignore:
Timestamp:
2018-07-05T21:41:19Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
48d9187
Parents:
22ba300
git-author:
Dzejrou <dzejrou@…> (2018-03-01 17:42:41)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:19)
Message:

added c++17 style value aliases and added char type as integral, because they are not typedefs anymore

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/impl/type_traits.hpp

    r22ba300 ree51635  
    103103
    104104    template<class T>
     105    inline constexpr bool is_void_v = is_void<T>::value;
     106
     107    template<class T>
    105108    struct is_null_pointer: aux::is_same<remove_cv_t<T>, nullptr_t>
    106109    { /* DUMMY BODY */ };
     110
     111    template<class T>
     112    inline constexpr bool is_null_pointer_v = is_null_pointer<T>::value;
    107113
    108114    template<class T>
     
    110116            bool, char, unsigned char, signed char,
    111117            long, unsigned long, int, unsigned int, short,
    112             unsigned short, long long, unsigned long long>
     118            unsigned short, long long, unsigned long long,
     119            char16_t, char32_t, wchar_t>
    113120    { /* DUMMY BODY */ };
    114121
     
    118125    { /* DUMMY BODY */ };
    119126
     127    template<class T>
     128    inline constexpr bool is_floating_point_v = is_floating_point<T>::value;
     129
    120130    template<class>
    121131    struct is_array: false_type
     
    125135    struct is_array<T[]>: true_type
    126136    { /* DUMMY BODY */ };
     137
     138    template<class T>
     139    inline constexpr bool is_array_v = is_array<T>::value;
    127140
    128141    namespace aux
     
    142155
    143156    template<class T>
     157    inline constexpr bool is_pointer_v = is_pointer<T>::value;
     158
     159    template<class T>
    144160    struct is_lvalue_reference: false_type
    145161    { /* DUMMY BODY */ };
     
    148164    struct is_lvalue_reference<T&>: true_type
    149165    { /* DUMMY BODY */ };
     166
     167    template<class T>
     168    inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<T>::value;
    150169
    151170    template<class T>
     
    156175    struct is_rvalue_reference<T&&>: true_type
    157176    { /* DUMMY BODY*/ };
     177
     178    template<class T>
     179    inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<T>::value;
    158180
    159181    template<class>
     
    168190                            !is_member_function_pointer<T>::value>
    169191    { /* DUMMY BODY */ };
     192
     193    template<class T>
     194    inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<T>::value;
    170195
    171196    template<class>
     
    188213
    189214    template<class T>
     215    inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<T>::value;
     216
     217    template<class T>
    190218    struct is_enum: aux::value_is<bool, __is_enum(T)>
    191219    { /* DUMMY BODY */ };
    192220
    193221    template<class T>
     222    inline constexpr bool is_enum_v = is_enum<T>::value;
     223
     224    template<class T>
    194225    struct is_union: aux::value_is<bool, __is_union(T)>
    195226    { /* DUMMY BODY */ };
    196227
    197228    template<class T>
     229    inline constexpr bool is_union_v = is_union<T>::value;
     230
     231    template<class T>
    198232    struct is_class: aux::value_is<bool, __is_class(T)>
    199233    { /* DUMMY BODY */ };
     234
     235    template<class T>
     236    inline constexpr bool is_class_v = is_class<T>::value;
    200237
    201238    /**
     
    399436    { /* DUMMY BODY */ };
    400437
     438    template<class T>
     439    inline constexpr bool is_function_v = is_function<T>::value;
     440
    401441    /**
    402442     * 20.10.4.2, composite type categories:
     
    414454    struct is_reference<T&&>: true_type
    415455    { /* DUMMY BODY */ };
     456
     457    template<class T>
     458    inline constexpr bool is_reference_v = is_reference<T>::value;
    416459
    417460    template<class T>
     
    420463        is_integral<T>::value || is_floating_point<T>::value>
    421464    { /* DUMMY BODY */ };
     465
     466    template<class T>
     467    inline constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
    422468
    423469    template<class T>
     
    448494    { /* DUMMY BODY */ };
    449495
     496    template<class T>
     497    inline constexpr bool is_member_pointer_v = is_member_pointer<T>::value;
     498
    450499    /**
    451500     * 20.10.4.3, type properties:
     
    461510
    462511    template<class T>
     512    inline constexpr bool is_const_v = is_const<T>::value;
     513
     514    template<class T>
    463515    struct is_volatile: false_type
    464516    { /* DUMMY BODY */};
     
    467519    struct is_volatile<T volatile>: true_type
    468520    { /* DUMMY BODY */ };
     521
     522    template<class T>
     523    inline constexpr bool is_volatile_v = is_volatile<T>::value;
    469524
    470525    /**
     
    486541
    487542    template<class T>
     543    inline constexpr bool is_trivial_v = is_trivial<T>::value;
     544
     545    template<class T>
    488546    struct is_trivially_copyable: aux::value_is<bool, __has_trivial_copy(T)>
    489547    { /* DUMMY BODY */ };
    490548
    491549    template<class T>
     550    inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<T>::value;
     551
     552    template<class T>
    492553    struct is_standard_layout;
    493554
     
    497558
    498559    template<class T>
     560    inline constexpr bool is_pod_v = is_pod<T>::value;
     561
     562    template<class T>
    499563    struct is_literal_type: aux::value_is<bool, __is_literal_type(T)>
    500564    { /* DUMMY BODY */ };
    501565
    502566    template<class T>
     567    inline constexpr bool is_literal_type_v = is_literal_type<T>::value;
     568
     569    template<class T>
    503570    struct is_empty: aux::value_is<bool, __is_empty(T)>
    504571    { /* DUMMY BODY */ };
    505572
    506573    template<class T>
     574    inline constexpr bool is_empty_v = is_empty<T>::value;
     575
     576    template<class T>
    507577    struct is_polymorphic: aux::value_is<bool, __is_polymorphic(T)>
    508578    { /* DUMMY BODY */ };
    509579
    510580    template<class T>
     581    inline constexpr bool is_polymorphic_v = is_polymorphic<T>::value;
     582
     583    template<class T>
    511584    struct is_abstract: aux::value_is<bool, __is_abstract(T)>
    512585    { /* DUMMY BODY */ };
    513586
    514587    template<class T>
     588    inline constexpr bool is_abstract_v = is_abstract<T>::value;
     589
     590    template<class T>
    515591    struct is_final: aux::value_is<bool, __is_final(T)>
    516592    { /* DUMMY BODY */ };
     593
     594    template<class T>
     595    inline constexpr bool is_final_v = is_final<T>::value;
    517596
    518597    namespace aux
     
    545624
    546625    template<class T>
     626    inline constexpr bool is_signed_v = is_signed<T>::value;
     627
     628    template<class T>
    547629    struct is_unsigned: aux::is_unsigned<T>
    548630    { /* DUMMY BODY */ };
     631
     632    template<class T>
     633    inline constexpr bool is_unsigned_v = is_unsigned<T>::value;
    549634
    550635    template<class T, class... Args>
     
    577662
    578663    template<class T>
     664    inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<T>::value;
     665
     666    template<class T>
    579667    struct is_trivially_default_constructible;
    580668
     
    582670    struct is_trivially_copy_constructible: aux::value_is<bool, __has_trivial_copy(T)>
    583671    { /* DUMMY BODY */ };
     672
     673    template<class T>
     674    inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<T>::value;
    584675
    585676    template<class T>
     
    590681    { /* DUMMY BODY */ };
    591682
     683    template<class T, class U>
     684    inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<T, U>::value;
     685
    592686    template<class T>
    593687    struct is_trivially_copy_assignable;
     
    599693    struct is_trivially_destructible: aux::value_is<bool, __has_trivial_destructor(T)>
    600694    { /* DUMMY BODY */ };
     695
     696    template<class T>
     697    inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<T>::value;
    601698
    602699    template<class T, class... Args>
     
    605702
    606703    template<class T>
     704    inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<T>::value;
     705
     706    template<class T>
    607707    struct is_nothrow_default_constructible;
    608708
     
    610710    struct is_nothrow_copy_constructible: aux::value_is<bool, __has_nothrow_copy(T)>
    611711    { /* DUMMY BODY */ };
     712
     713    template<class T>
     714    inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<T>::value;
    612715
    613716    template<class T>
     
    618721    { /* DUMMY BODY */ };
    619722
     723    template<class T, class U>
     724    inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<T, U>::value;
     725
    620726    template<class T>
    621727    struct is_nothrow_copy_assignable;
     
    630736    struct has_virtual_destructor: aux::value_is<bool, __has_virtual_destructor(T)>
    631737    { /* DUMMY BODY */ };
     738
     739    template<class T>
     740    inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<T>::value;
    632741
    633742    /**
     
    650759    { /* DUMMY BODY */ };
    651760
     761    template<class T>
     762    inline constexpr size_t rank_v = rank<T>::value;
     763
    652764    template<class T, unsigned I = 0>
    653765    struct extent;
     
    661773    { /* DUMMY BODY */ };
    662774
     775    template<class T, class U>
     776    inline constexpr bool is_same_v = is_same<T, U>::value;
     777
    663778    template<class Base, class Derived>
    664779    struct is_base_of;
     780
     781    template<class Base, class Derived>
     782    inline constexpr bool is_base_of_v = is_base_of<Base, Derived>::value;
    665783
    666784    template<class From, class To>
Note: See TracChangeset for help on using the changeset viewer.