On Mon, May 3, 2021 at 10:04 AM Bjorn Reese <breese@stofanet.dk> wrote:
On 2021-05-02 18:56, Arthur O'Dwyer wrote:
> I emphasize "for a real problem" because the code you've showed above is
> not real: `alpha` is an empty struct, and you didn't provide the body of
> the "value constructor," so it's not clear to the reader what it's
> planning to do with the T&& it receives.

My draft contains four use-cases from the standard (std::any,
std::thread, std::range::common_view, and std::not_fn) and one ongoing
proposal (std::any_invocable.)

Good. Show those examples. "Naming some STL types" is not an example. Show what those pieces of code look like, for real, before and after your change.


> However, I don't see any need to standardize is_same_uncvref; it seems
> trivial to write by hand.
> Notice I could also have done
>      requires (not same_as<remove_cvref_t<T>, AlphableRef>)
> which is almost as short.

But not the same.

The full hand-written example is:

   requires (constructible_from<AlphableRef, T, Args...>
             and not same_as<remove_cvref_t<T>, AlphableRef)

No, that's obviously incorrect. AlphaRef can't have a constructor template that's gated on whether AlphaRef is constructible from something.
Also, it seems that now you're inventing a parameter `Args...` that wasn't there in my example?  What is `Args...`?


In my specific example, if you wanted to concept-ify it, you'd do:

    // https://godbolt.org/z/e7vErWfPW

    template<class T>
        // "value-construct" from anything that's not cvref-qualified `AlphableRef`...
        requires (not is_same_uncvref<T, AlphableRef>::value)
    AlphableRef(T&& t)
        // ...and that matches our ad-hoc "provides an alpha member" concept
        requires requires { t.alpha(); }
    {

For AlphaRef, there was never any requirement that anything in particular be constructible-from T itself.

This is why I say your paper (A) is confused, and (B) needs concrete examples.  You can't just wave your hands and say "well, let's postulate a constraint `is_value_constructible_from<Me, T>` that just magically does the thing I want in each different case."  And when you're called on it, you can't just say "well, how about if we add some `Args...` somewhere."

–Arthur