--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussio...@isocpp.org.
To post to this group, send email to std-dis...@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-discussion/.
I hadn't considered the explicitly deleted special members. In the context of special members it might not be such a problem as when you delete a copy constructor you will likely not introduce another constructor that will be a match for the overload resolution.
Could you give a more complete explanation of the problem that might arise from the proposal ?On 06/20/2013 10:26 PM, Nevin Liber wrote:
On 20 June 2013 15:13, François Dumont <frs.d...@gmail.com> wrote:
I hadn't considered the explicitly deleted special members. In the context of special members it might not be such a problem as when you delete a copy constructor you will likely not introduce another constructor that will be a match for the overload resolution.
We run into this problem with frightening regularity now:
struct Foo
{
template<class T>
Foo(T&&) { /* better match for "copies" of non-const objects */ }
};
I'd rather not exasperate it. In addition, the simplest workaround, adding a Foo(Foo&) constructor, can no longer be used, because it too is a special member function.
Your Foo struct looks like the Gnu std::pair definition. The copy constructor is defaulted and the template constructor that could be used if the proposal was adopted are decorated in such a way that their definition won't be compilable. In your case it would be something like:
struct Foo
{
template<class T,
class = typename std::enable_if</* some condition invalid for this constructor */>::type >
Foo(T&&) { /* ... */ }
};
If we want a separate category of deleted functions that aren't part of the overload set, let's mark them differently than "=delete".
On 22 June 2013 14:46, François Dumont <frs.d...@gmail.com> wrote:
On 06/20/2013 10:26 PM, Nevin Liber wrote:
On 20 June 2013 15:13, François Dumont <frs.d...@gmail.com> wrote:
I hadn't considered the explicitly deleted special members. In the context of special members it might not be such a problem as when you delete a copy constructor you will likely not introduce another constructor that will be a match for the overload resolution.
We run into this problem with frightening regularity now:
struct Foo
{
template<class T>
Foo(T&&) { /* better match for "copies" of non-const objects */ }
};
I'd rather not exasperate it. In addition, the simplest workaround, adding a Foo(Foo&) constructor, can no longer be used, because it too is a special member function.
struct Foo
{
template<class T,
class = typename std::enable_if</* some condition invalid for this constructor */>::type >
Foo(T&&) { /* ... */ }
};
Sure, I can write that. But a non-expert?
The fact that we need *anything* to differentiate between:
Foo f;
const Foo cf;
Foo copycf(cf); // calls copy constructor
Foo copyf(f) // calls templated constructor
is a language problem that trips many developers up. Forcing developers to use SFINAE to get around this problem is an aberration.
The current workaround I recommend is:
Foo(Foo& that) : Foo(static_cast<Foo const&>(that)) {}
It seems that making the rules even more convoluted just to satisfy the world's most complicated struct of two elements feels like the wrong approach to me.
Will such a change silently break users code where they have explicitly deleted functions so that they no longer compile?
If we want a separate category of deleted functions that aren't part of the overload set, let's mark them differently than "=delete".
Does Concepts Lite solve this?
First, even if English is not my mother tongue, the keyword 'delete' has a clear meaning which is that something deleted should not exist anymore. With the current Standard something deleted can have a side effect on the overload resolution, it really surprises me when I realized it.