C++ Logo

STD-DISCUSSION

Advanced search

Subject: enabling default keyword for default method and function values
From: Vishal Oza (vickoza_at_[hidden])
Date: 2019-11-11 10:00:09


I just wanted to know if the following idea is a bad idea. Should we enable
using the default keyword to function input value parameter if we only care
about one parameter that have default parameters both before and after the
parameter we care about?
For example:

int foo(int bar = 3, int baz = 7, int* foobar = nullptr, int* foobaz =
nullptr) { ... }
...

int foobazval = 78;
auto fooval = foo(13, default, default, &foobazval); // = foo(13, 7,
nullptr, &foobazval)

The exceptions are references where there should never be a default value
and possibly type with no default this is only a possibly because the type
could be the same value as the type if the type was default constructed.



STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups