Re: [Boost-bugs] [Boost C++ Libraries] #1403: Enable copying boost::array to const

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1403: Enable copying boost::array to const
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-11-09 03:40:33


#1403: Enable copying boost::array to const
---------------------------------+------------------------------------------
  Reporter: pop.atry_at_[hidden] | Owner:
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: None
   Version: Boost 1.34.1 | Severity: Problem
Resolution: | Keywords:
---------------------------------+------------------------------------------
Comment (by steven_watanabe):

 The only easy way I can see of implementing this feature
 is to add a constructor. This breaks aggregate-ness.

 There is one other way to do it, which I would rather not contemplate.

 {{{

 template<class Dest, class T>
 Dest array_cast(const boost::array<T, 0>&) {
     Dest result = {};
     return(result);
 }

 template<class Dest, class T>
 Dest array_cast(const boost::array<T, 1>& from) {
     Dest result = {from[0]};
     return(result);
 }

 template<class Dest, class T>
 Dest array_cast(const boost::array<T, 2>& from) {
     Dest result = {from[0], from[1]};
     return(result);
 }

 // and so on

 }}}

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1403#comment:2>
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:49:56 UTC