Another crowd-pleaser in C++17 is the ability to declared nested namespaces without literally nesting them. In the past, you had to do this, which involves a lot of wasted whitespace:
namespace NestedNamespaces
{
namespace Really
{
namespace Work
{
auto return_int(){ return 42; };
}
}
}
Happily, you can now do this instead:
namespace NestedNamespaces::Really::Work
{
auto return_int(){ return 42; };
}
TEST( Cpp17, nested_namespaces )
{
EXPECT_EQ( 42, NestedNamespaces::Really::Work::return_int() );
}
See also previous C++17 post.
Pingback: C++17: Structured Bindings | musingstudio
Pingback: C++17: Lambdas | musingstudio