lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Default values for default arguments


From: Greg Chicares
Subject: Re: [lmi] Default values for default arguments
Date: Sat, 11 Feb 2017 10:16:07 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

On 2017-02-10 16:58, Vadim Zeitlin wrote:
> 
>  I'd also consider using "Foo{}" instead of "Foo()" for the constructors of
> temporary objects (although lmi code doesn't use them much, I think),
> because the former is much more clear as it doesn't look like a function
> call.

Discussion of selected `grep 'std::string()'` results:

datum_sequence.cpp:    return std::string();
rate_table_test.cpp:        stream_out_.str(std::string());
rate_table_tool.cpp:        name_map.emplace(num, std::string());

In those cases, the type 'std::string' must be named, and I think you're
saying you'd prefer {} to ().

antediluvian_stubs.cpp:    std::string const empty_string = std::string();

How about that one? Which of the following...
  std::string const empty_string = std::string(); // Leave it alone.
  std::string const empty_string = std::string{}; // Prefer {} to ().
  std::string const empty_string{}; // Don't even name the type.

wx_test_paste_census.cpp:    ,std::string const& unexpected = std::string()

How about this one, which is a defaulted argument? I ask this because
earlier we had decided to write that exactly as above. But it's okay
to change our minds; which would you now prefer?
  ,std::string const& unexpected = std::string()
  ,std::string const& unexpected = std::string{}
  ,std::string const& unexpected{}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]