Re: [Boost-bugs] [Boost C++ Libraries] #11330: boost::chrono::duration default constructor doesn't initialize rep_

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11330: boost::chrono::duration default constructor doesn't initialize rep_
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-21 20:42:50


#11330: boost::chrono::duration default constructor doesn't initialize rep_
---------------------------------+------------------------
  Reporter: florent.castelli@… | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: chrono
   Version: Boost 1.58.0 | Severity: Regression
Resolution: | Keywords:
---------------------------------+------------------------
Changes (by viboes):

 * status: new => assigned

Comment:

 Hi,

 you are right that there is an inconsistency I need to document.

 The correct behavior is, following the standard, to don't initialize it. I
 received a request to be able to initialize it a zero.

 I'm really sorry, but I would not initialize it in c++11. I could add a
 compiler flag to force the initialization.


 {{{
 #if defined BOOST_NO_CXX11_DEFAULTED_FUNCTIONS || \
      defined BOOST_CHRONO_DURATION_DEFAULTS_TO_ZERO
         BOOST_FORCEINLINE BOOST_CONSTEXPR
         duration() : rep_(duration_values<rep>::zero()) { }
 #else
         BOOST_CONSTEXPR duration() BOOST_NOEXCEPT {};
 #endif
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11330#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:18 UTC