C++ Logo


Advanced search

[std-proposals] Detection of whether a determined user-defined literal is declared

From: veronica alphonso <verodeving_at_[hidden]>
Date: Tue, 15 Aug 2023 16:56:44 +0100
I would like to add a feature to the concepts(or type_traits if it's a
better fit) library, which determines whether a user-defined literal is
defined in the actual TU given the types of the param-list and the suffix
for it, like:

namespace std {
    enum class user_defined_literal_parameters : uint8_t{
        const_char_pointer = 0u,
        unsigned_long_long_int = 1u,
        long_double = 2u,
        char_ = 3u,
        wchar_t_ = 4u,
        char8_t_ = 5u,
        char16_t_ = 6u,
        char32_t_ = 7u,
        const_char_pointer_with_size = 8u,
        const_wchar_t_pointer_with_size = 9u,
        const_char8_t_pointer_with_size = 10u,
        const_char16_t_pointer_with_size = 11u,
        const_char32_t_pointer_with_size = 12u

    template<user_defined_literal_parameters param, const char* suffix>
    concept user_defined_literal = /* to determine... */;

    template<class R, user_defined_literal_parameters param, const char*
    concept user_defined_literal_r = /* to determine... */;


- `R` is the returning type(can be optional in the form of an extra concept
for the users that might don't care about the returning type of the
user-defined literal)

- `param` defines the parameter declaration clause and

- `suffix` defines the user-defined suffix used for the user-defined literal

Received on 2023-08-15 15:56:56