Changeset 6d4e0d9 in mainline


Ignore:
Timestamp:
2018-07-05T21:41:17Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2841b4f
Parents:
5abc7fd
git-author:
Jaroslav Jindrak <dzejrou@…> (2017-10-13 19:20:56)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:17)
Message:

cpp: added more type traits

File:
1 edited

Legend:

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

    r5abc7fd r6d4e0d9  
    197197
    198198    template<class T>
    199     struct is_lvalue_reference;
    200 
    201     template<class T>
    202     struct is_rvalue_reference;
    203 
    204     template<class T>
    205     struct is_member_object_pointer;
    206 
    207     template<class T>
     199    struct is_lvalue_reference: false_type
     200    { /* DUMMY BODY */ };
     201
     202    template<>
     203    struct is_lvalue_reference<T&>: true_type
     204    { /* DUMMY BODY */ };
     205
     206    template<class T>
     207    struct is_rvalue_reference: false_type
     208    { /* DUMMY BODY*/ };
     209
     210    template<>
     211    struct is_rvalue_reference<T&&>: true_type
     212    { /* DUMMY BODY*/ };
     213
     214    template<class>
     215    struct is_member_pointer;
     216
     217    template<class>
    208218    struct is_member_function_pointer;
    209219
    210220    template<class T>
    211     struct is_enum;
    212 
    213     template<class T>
    214     struct is_union;
    215 
    216     template<class T>
    217     struct is_class;
    218 
    219     template<class T>
     221    struct is_member_object_pointer
     222        : integral_constant<bool, is_member_pointer<T>::value &&
     223                            !is_member_function_pointer<T>::value>
     224    { /* DUMMY BODY */ };
     225
     226    template<class>
    220227    struct is_function;
    221228
     229    template<class T>
     230    struct __is_member_function_pointer: false_type
     231    { /* DUMMY BODY */ };
     232
     233    template<class T, class U>
     234    struct __is_member_function_pointer<T U::*>: is_function<T>
     235    { /* DUMMY BODY */ };
     236
     237    template<class T>
     238    struct is_member_function_pointer: __is_member_function_pointer<remove_cv_t<T>>
     239    { /* DUMMY BODY */ };
     240
     241    template<class T>
     242    struct is_enum; // TODO: No idea how to implement.
     243
     244    template<class T>
     245    struct is_union; // TODO: No idea how to implement.
     246
     247    template<class T>
     248    struct is_class; // TODO: No idea how to implement.
     249
     250    /**
     251     * Note: is_function taken from possile implementation on cppreference.com
     252     */
     253    template<class>
     254    struct is_function: false_type
     255    { /* DUMMY BODY */ };
     256
     257    template<class Ret, class... Args>
     258    struct is_function<Ret(Args...)>: true_type
     259    { /* DUMMY BODY */ };
     260
     261    // Note: That hexadot covers variadic functions like printf.
     262    template<class Ret, class... Args>
     263    struct is_function<Ret(Args......)>: true_type
     264    { /* DUMMY BODY */ }
     265
     266    template<class Ret, class... Args>
     267    struct is_function<Ret(Args...) const>: true_type
     268    { /* DUMMY BODY */ };
     269
     270    template<class Ret, class... Args>
     271    struct is_function<Ret(Args...) volatile>: true_type
     272    { /* DUMMY BODY */ };
     273
     274    template<class Ret, class... Args>
     275    struct is_function<Ret(Args...) const volatile>: true_type
     276    { /* DUMMY BODY */ };
     277
     278    template<class Ret, class... Args>
     279    struct is_function<Ret(Args......) const>: true_type
     280    { /* DUMMY BODY */ };
     281
     282    template<class Ret, class... Args>
     283    struct is_function<Ret(Args......) volatile>: true_type
     284    { /* DUMMY BODY */ };
     285
     286    template<class Ret, class... Args>
     287    struct is_function<Ret(Args......) const volatile>: true_type
     288    { /* DUMMY BODY */ };
     289
     290    template<class Ret, class... Args>
     291    struct is_function<Ret(Args...) &>: true_type
     292    { /* DUMMY BODY */ };
     293
     294    template<class Ret, class... Args>
     295    struct is_function<Ret(Args...) const &>: true_type
     296    { /* DUMMY BODY */ };
     297
     298    template<class Ret, class... Args>
     299    struct is_function<Ret(Args...) volatile &>: true_type
     300    { /* DUMMY BODY */ };
     301
     302    template<class Ret, class... Args>
     303    struct is_function<Ret(Args...) const volatile &>: true_type
     304    { /* DUMMY BODY */ };
     305
     306    template<class Ret, class... Args>
     307    struct is_function<Ret(Args......) &>: true_type
     308    { /* DUMMY BODY */ };
     309
     310    template<class Ret, class... Args>
     311    struct is_function<Ret(Args......) const &>: true_type
     312    { /* DUMMY BODY */ };
     313
     314    template<class Ret, class... Args>
     315    struct is_function<Ret(Args......) volatile &>: true_type
     316    { /* DUMMY BODY */ };
     317
     318    template<class Ret, class... Args>
     319    struct is_function<Ret(Args......) const volatile &>: true_type
     320    { /* DUMMY BODY */ };
     321
     322    template<class Ret, class... Args>
     323    struct is_function<Ret(Args...) &&>: true_type
     324    { /* DUMMY BODY */ };
     325
     326    template<class Ret, class... Args>
     327    struct is_function<Ret(Args...) const &&>: true_type
     328    { /* DUMMY BODY */ };
     329
     330    template<class Ret, class... Args>
     331    struct is_function<Ret(Args...) volatile &&>: true_type
     332    { /* DUMMY BODY */ };
     333
     334    template<class Ret, class... Args>
     335    struct is_function<Ret(Args...) const volatile &&>: true_type
     336    { /* DUMMY BODY */ };
     337
     338    template<class Ret, class... Args>
     339    struct is_function<Ret(Args......) &&>: true_type
     340    { /* DUMMY BODY */ };
     341
     342    template<class Ret, class... Args>
     343    struct is_function<Ret(Args......) const &&>: true_type
     344    { /* DUMMY BODY */ };
     345
     346    template<class Ret, class... Args>
     347    struct is_function<Ret(Args......) volatile &&>: true_type
     348    { /* DUMMY BODY */ };
     349
     350    template<class Ret, class... Args>
     351    struct is_function<Ret(Args......) const volatile &&>: true_type
     352    { /* DUMMY BODY */ };
     353
     354    template<class Ret, class... Args>
     355    struct is_function<Ret(Args...) noexcept>: true_type
     356    { /* DUMMY BODY */ };
     357
     358    template<class Ret, class... Args>
     359    struct is_function<Ret(Args......) noexcept>: true_type
     360    { /* DUMMY BODY */ };
     361
     362    template<class Ret, class... Args>
     363    struct is_function<Ret(Args...) const noexcept>: true_type
     364    { /* DUMMY BODY */ };
     365
     366    template<class Ret, class... Args>
     367    struct is_function<Ret(Args...) volatile noexcept>: true_type
     368    { /* DUMMY BODY */ };
     369
     370    template<class Ret, class... Args>
     371    struct is_function<Ret(Args...) const volatile noexcept>: true_type
     372    { /* DUMMY BODY */ };
     373
     374    template<class Ret, class... Args>
     375    struct is_function<Ret(Args......) const noexcept>: true_type
     376    { /* DUMMY BODY */ };
     377
     378    template<class Ret, class... Args>
     379    struct is_function<Ret(Args......) volatile noexcept>: true_type
     380    { /* DUMMY BODY */ };
     381
     382    template<class Ret, class... Args>
     383    struct is_function<Ret(Args......) const volatile noexcept>: true_type
     384    { /* DUMMY BODY */ };
     385
     386    template<class Ret, class... Args>
     387    struct is_function<Ret(Args...) & noexcept>: true_type
     388    { /* DUMMY BODY */ };
     389
     390    template<class Ret, class... Args>
     391    struct is_function<Ret(Args...) const & noexcept>: true_type
     392    { /* DUMMY BODY */ };
     393
     394    template<class Ret, class... Args>
     395    struct is_function<Ret(Args...) volatile & noexcept>: true_type
     396    { /* DUMMY BODY */ };
     397
     398    template<class Ret, class... Args>
     399    struct is_function<Ret(Args...) const volatile & noexcept>: true_type
     400    { /* DUMMY BODY */ };
     401
     402    template<class Ret, class... Args>
     403    struct is_function<Ret(Args......) & noexcept>: true_type
     404    { /* DUMMY BODY */ };
     405
     406    template<class Ret, class... Args>
     407    struct is_function<Ret(Args......) const & noexcept>: true_type
     408    { /* DUMMY BODY */ };
     409
     410    template<class Ret, class... Args>
     411    struct is_function<Ret(Args......) volatile & noexcept>: true_type
     412    { /* DUMMY BODY */ };
     413
     414    template<class Ret, class... Args>
     415    struct is_function<Ret(Args......) const volatile & noexcept>: true_type
     416    { /* DUMMY BODY */ };
     417
     418    template<class Ret, class... Args>
     419    struct is_function<Ret(Args...) && noexcept>: true_type
     420    { /* DUMMY BODY */ };
     421
     422    template<class Ret, class... Args>
     423    struct is_function<Ret(Args...) const && noexcept>: true_type
     424    { /* DUMMY BODY */ };
     425
     426    template<class Ret, class... Args>
     427    struct is_function<Ret(Args...) volatile && noexcept>: true_type
     428    { /* DUMMY BODY */ };
     429
     430    template<class Ret, class... Args>
     431    struct is_function<Ret(Args...) const volatile && noexcept>: true_type
     432    { /* DUMMY BODY */ };
     433
     434    template<class Ret, class... Args>
     435    struct is_function<Ret(Args......) && noexcept>: true_type
     436    { /* DUMMY BODY */ };
     437
     438    template<class Ret, class... Args>
     439    struct is_function<Ret(Args......) const && noexcept>: true_type
     440    { /* DUMMY BODY */ };
     441
     442    template<class Ret, class... Args>
     443    struct is_function<Ret(Args......) volatile && noexcept>: true_type
     444    { /* DUMMY BODY */ };
     445
     446    template<class Ret, class... Args>
     447    struct is_function<Ret(Args......) const volatile && noexcept>: true_type
     448    { /* DUMMY BODY */ };
     449
    222450    /**
    223451     * 20.10.4.2, composite type categories:
     
    243471
    244472    template<class T>
    245     struct is_member_pointer;
     473    struct __is_member_pointer: false_type
     474    { /* DUMMY BODY */ };
     475
     476    template<class T, class U>
     477    struct __is_member_pointer<T U::*>: true_type
     478    { /* DUMMY BODY */ };
     479
     480    template<class T>
     481    struct is_member_pointer: __is_member_pointer<remove_cv_t<T>>;
    246482
    247483    /**
Note: See TracChangeset for help on using the changeset viewer.