This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

1399. function does not need an explicit default constructor

Section: [func.wrap.func] Status: C++11 Submitter: Japan Opened: 2010-08-25 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [func.wrap.func].

View all issues with C++11 status.


Addresses JP-3

explicit default contructor is defined in std::function. Although it is allowed according to 12.3.1, it seems unnecessary to qualify the constructor as explicit. If it is explicit, there will be a limitation in initializer_list.

[ Resolved in Rapperswil by a motion to directly apply the words from the ballot comment in N3102. ]

Proposed resolution:

Remove explicit.

namespace std {
template<class> class function;
// undefined
template<class R, class... ArgTypes>
class function<R(ArgTypes...)>
: public unary_function<T1, R>
// iff sizeof...(ArgTypes) == 1 and ArgTypes contains T1
: public binary_function<T1, T2, R>
// iff sizeof...(ArgTypes) == 2 and ArgTypes contains T1 andT2
public:typedef R result_type;
//, construct/copy/destroy:
  explicit function();