[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] depr.impldec
From: |
Greg Chicares |
Subject: |
Re: [lmi] depr.impldec |
Date: |
Thu, 28 Jul 2022 09:53:07 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 |
On 7/28/22 00:29, Vadim Zeitlin wrote:
> On Wed, 27 Jul 2022 19:55:32 +0000 Greg Chicares <gchicares@sbcglobal.net>
> wrote:
>
> GC> On 7/13/22 20:51, Greg Chicares wrote:
> GC> [...]
> GC> > I weakly favor the Rule of Zero, while you more strongly favor
> GC> > the Rule of Five, so let's start with a universal Rule of Five
> GC>
> GC> I've changed my opinion.
[...]
> One benefit that I hadn't mentioned yet, I think, is that if you ever
> define a special member in your class, e.g. decide to do something in the
> default ctor, it would silently inhibit moving. This should, arguably,
> happen only rarely, but I guarantee that if it does happen, it will remain
> unnoticed for a long time.
Unless we guarantee that it cannot happen, e.g., with "concept" assertions.
But you mentioned that technique in another thread, where I'll reply soon.
> Also, there are many important exceptions, e.g. you still have to write
> all 5 special members for any polymorphic base classes
But we can write them all once...
#include "crtp_base.hpp"
...and only once:
class A : private lmi::polymorphic_base<A> {};
static_assert( std::is_polymorphic_v <A>);
static_assert( std::is_default_constructible_v <A>);
static_assert( std::is_destructible_v <A>);
static_assert( std::is_copy_constructible_v <A>);
static_assert( std::is_move_constructible_v <A>);
static_assert( std::is_copy_assignable_v <A>);
static_assert( std::is_move_assignable_v <A>);
(and those assertions can be combined into one "concept").
- Re: [lmi] depr.impldec, (continued)
Re: [lmi] depr.impldec, Greg Chicares, 2022/07/13
Re: [lmi] depr.impldec, Greg Chicares, 2022/07/27
Re: [lmi] depr.impldec, Vadim Zeitlin, 2022/07/27
Re: [lmi] depr.impldec,
Greg Chicares <=
Re: [lmi] depr.impldec, Vadim Zeitlin, 2022/07/28
Re: [lmi] depr.impldec, Greg Chicares, 2022/07/28
Re: [lmi] depr.impldec, Vadim Zeitlin, 2022/07/28
Re: [lmi] depr.impldec, Greg Chicares, 2022/07/13
- Re: [lmi] depr.impldec, Greg Chicares, 2022/07/13
- Re: [lmi] depr.impldec, Vadim Zeitlin, 2022/07/13
- Re: [lmi] depr.impldec, Greg Chicares, 2022/07/14
- Re: [lmi] depr.impldec, Vadim Zeitlin, 2022/07/14
- Re: [lmi] depr.impldec, Greg Chicares, 2022/07/14
- Re: [lmi] depr.impldec, Greg Chicares, 2022/07/14