Is it legal to declare a constexpr initializer_list object?

Update: The situation got a bit more complicated after the resolution of CWG DR 1684 removed the requirement quoted below. Some more information can be found in this discussion on the std-discussion mailing list and in the related question Why isn’t `std::initializer_list` defined as a literal type? [decl.constexpr]/8: A constexpr specifier for a non-static member … Read more

What is the purpose and usage of `memory_resource`?

A polymorphic_allocator is intended to let you have an allocator whose behavior is dynamically determined at runtime. The only way to create a polymorphic_allocator is: Default constructed, in which case it uses std::pmr::get_default_resource() return value, which is a memory_resource*. Pass it a memory_resource*. copy from another polymorphic_allocator. So the point of customization for a polymorphic_allocator … Read more

How to mock templated methods using Google Mock?

In previous version of Google Mock you can only mock virtual functions, see the documentation in the project’s page. More recent versions allowed to mock non-virtual methods, using what they call hi-perf dependency injection. As user @congusbongus states in the comment below this answer: Google Mock relies on adding member variables to support method mocking, … Read more

Quick sort at compilation time using C++11 variadic templates

Have you also looked at its memory consumption? Note that quicksort itself is worse than linear, with a quite bad worse case runtime. This multiplies with the worse than linear runtime behaviour of certain steps of template compilation and instantiation (sometimes those are exponentional). You should maybe graph your compiletime for various datasets to observe … Read more

Will C++17 allow forward declaration of nested classes?

There’s a proposal on the issue titled Forward declarations of nested classes P0289R0. However as you can see from the last Trip Report: C++ Standards Meeting in Jacksonville, February 2016, this proposal was pendent to proposals for which further work is encouraged. I’m quoting the verdict of the committee (Emphasis Mine): This would allow things … Read more