Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9201: CopyConstructible, as a side effect, requires the type to be DefaultConstructible.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-04-03 12:23:50
#9201: CopyConstructible, as a side effect, requires the type to be
DefaultConstructible.
-------------------------------------+-------------------------------------
Reporter: David LaÅ¡toviÄka | Owner: jsiek
<david@â¦> | Status: new
Type: Bugs | Component: concept_check
Milestone: To Be Determined | Severity: Problem
Version: Boost Development | Keywords: concept
Trunk | CopyConstructible
Resolution: | DefaultConstructible Assignable
-------------------------------------+-------------------------------------
Comment (by david@â¦):
{{{T u = v;}}}
involves default construction and copy assignment, i.e. requires
implementation of the ''default constructor''
{{{T()}}}
and ''copy assignment operator''
{{{T &operator=(const T&)}}}
Copy construction is implemented using ''copy constructor'' with signature
{{{T(const T &)}}}
My astute observation is: DefaultConstructible, CopyConstructible or
CopyAssignable do correspond to the fact whether class implements
''default constructor'', ''copy constructor'' or ''assignment operator''.
As, on the level of the language, you can implement or not implement any
of these 3 members independently on the presence of the implementation of
the other 2, so I don't see a reason why there should be some dependencies
on the level of the concepts.
It would be better to have a quotation from the standard rather than
''astute observations'' but my possibilities to quote do not go beyond
sites like cppreference.com.
Personally I like to create classes that are always initialized with a
constructor with arguments and I forbid the default constructor in order
to avoid existence of uninitialized objects. That's how I bumped into
this.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9201#comment:3> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC