95 views

Skip to first unread message

Mar 20, 2014, 2:13:09 AM3/20/14

to

Both C++11 and the C++14 draft seem to be missing semantics

of several std::function's constructors.

[func.wrap.func]:

// 20.9.11.2.1, construct/copy/destroy:

function() noexcept;

function(nullptr_t) noexcept;

function(const function&);

function(function&&);

template<class F> function(F);

template<class A> function(allocator_arg_t, const A&) noexcept;

...

20.9.11.2.1 function construct/copy/destroy [func.wrap.func.con]

defines semantics for the constructors with allocator_arg_t as

the first parameter but not, for example, template<class F> function(F).

Is that an oversight or am I missing something?

I'm trying to understand whether template<class F> function(F) is

required to participate in overload resolution if and only if F is

Callable for argument types ArgTypes and return type R.

Roman Perepelitsa.

--

[ comp.std.c++ is moderated. To submit articles, try posting with your ]

[ newsreader. If that fails, use mailto:std-cpp...@vandevoorde.com ]

[ --- Please see the FAQ before posting. --- ]

[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]

of several std::function's constructors.

[func.wrap.func]:

// 20.9.11.2.1, construct/copy/destroy:

function() noexcept;

function(nullptr_t) noexcept;

function(const function&);

function(function&&);

template<class F> function(F);

template<class A> function(allocator_arg_t, const A&) noexcept;

...

20.9.11.2.1 function construct/copy/destroy [func.wrap.func.con]

defines semantics for the constructors with allocator_arg_t as

the first parameter but not, for example, template<class F> function(F).

Is that an oversight or am I missing something?

I'm trying to understand whether template<class F> function(F) is

required to participate in overload resolution if and only if F is

Callable for argument types ArgTypes and return type R.

Roman Perepelitsa.

--

[ comp.std.c++ is moderated. To submit articles, try posting with your ]

[ newsreader. If that fails, use mailto:std-cpp...@vandevoorde.com ]

[ --- Please see the FAQ before posting. --- ]

[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]

Mar 21, 2014, 4:11:45 PM3/21/14

to

Am 20.03.2014 07:13, schrieb Roman Perepelitsa:

>

> Both C++11 and the C++14 draft seem to be missing semantics

> of several std::function's constructors.

>

> [func.wrap.func]:

>

> // 20.9.11.2.1, construct/copy/destroy:

> function() noexcept;

> function(nullptr_t) noexcept;

> function(const function&);

> function(function&&);

> template<class F> function(F);

> template<class A> function(allocator_arg_t, const A&) noexcept;

> ...

>

> 20.9.11.2.1 function construct/copy/destroy [func.wrap.func.con]

> defines semantics for the constructors with allocator_arg_t as

> the first parameter but not, for example, template<class F> function(F).

>

> Is that an oversight or am I missing something?

As of acceptance of LWG 2132
>

> Both C++11 and the C++14 draft seem to be missing semantics

> of several std::function's constructors.

>

> [func.wrap.func]:

>

> // 20.9.11.2.1, construct/copy/destroy:

> function() noexcept;

> function(nullptr_t) noexcept;

> function(const function&);

> function(function&&);

> template<class F> function(F);

> template<class A> function(allocator_arg_t, const A&) noexcept;

> ...

>

> 20.9.11.2.1 function construct/copy/destroy [func.wrap.func.con]

> defines semantics for the constructors with allocator_arg_t as

> the first parameter but not, for example, template<class F> function(F).

>

> Is that an oversight or am I missing something?

http://cplusplus.github.io/LWG/lwg-defects.html#2132

this has been clarified. We have now for

template<class F> function(F f);

template <class F, class A> function(allocator_arg_t, const A& a, F f);

the following normative wording in [func.wrap.func.con] p8:

Remarks: These constructors shall not participate in overload

resolution unless f is Callable (20.9.11.2) for argument types

ArgTypes... and return type R.

> I'm trying to understand whether template<class F> function(F) is

> required to participate in overload resolution if and only if F is

> Callable for argument types ArgTypes and return type R.

HTH & Greetings from Bremen,

Daniel Krügler

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu