Re: [Boost-bugs] [Boost C++ Libraries] #9201: CopyConstructible, as a side effect, requires the type to be DefaultConstructible.

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: 2014-02-18 12:37:14


#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 acharles):

 I think the only way to fix this is to have the following approach:

 TT* b_ptr = NULL;
 if (b_ptr) {
   TT& b = *b_ptr;
   TT a(b); // Though I wonder if this shouldn't require an implicit copy
 constructor.
   TT* ptr = &a;
   ...
 }

 This is the only way I can think of to create an object of type TT without
 relying on default construction, while also not invoking undefined
 behavior and also having it require compilation.

 Is there a better idea?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9201#comment:1>
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:15 UTC