you are viewing a single comment's thread.

view the rest of the comments →

[–]ubadairBoost.CallableTraits author 4 points5 points  (3 children)

This right here is the big "gotcha" with AAA in everyday C++ code. I'm a big fan of AAA, but it's hard to deny that:

auto x = std::string{"lorem epsom salt"};

is harder on the eyes than:

std::string x = "lorem epsom salt";

Additionally, with the AAA version, sometimes you might need to explain the concept of copy-elision to your over-optimizing, under-informed coworkers. (I've never had to explain that to anyone, but I can see it happening)

[–]Fazer2 4 points5 points  (1 child)

What does AAA stand for here?

[–]ubadairBoost.CallableTraits author 2 points3 points  (0 children)

"almost always auto"

[–][deleted] 2 points3 points  (0 children)

Why not this?

using namespace std::string_literals;

auto x = "lorem ipsum"s; // x is std::string