C++ Logo


Advanced search

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

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Tue, 15 Aug 2023 23:19:19 +0200
On 15/08/2023 20.05, veronica alphonso wrote:
> An example of using this proposed feature(and userexpr, which is another feature yet to propose) would be:

So, you're asking for a new feature to support yet another novel feature.

> template<class R, class T, const char* suffix, bool sized = true>
> requires std::user_defined_literal_r<R, types_to_params<T, std::conditional_t<sized, std::size_t, void>>, suffix>
> constexpr R instantiate_usl(T t)
> {
> return userexpr(t, sized, suffix);
> // userexpr converts the given instance, sized or not, and suffix to its literal representation
> // in the form of an expression
> }

Why can't you use

  requires { userexpr(t, sized, suffix }

in your concept, then? All you want to check is whether the given "userexpr"
is valid or not.

(I'm not offering an opinion whether "userexpr" is a good idea to start with.)


Received on 2023-08-15 21:19:26