Your weekly dose of modern C++ challenge (Release every
Sunday
).
-
How to contribute/add a solution?
- Contributions are always very much appreciated. Just create a Pull Request with your solution.
C++26
- Did you know about C++26 proposal - Aggregates are named tuples?
- Did you know that C++26 added new SI prefixes?
- Did you know that C++26 changed arithmetic overloads of std::to_string and std::to_wstring to use std::format?
- Did you know that C++26 added more constexpr for
<cmath>
and<complex>
? - Did you know that C++26 added testing for success or failure of
<charconv>
functions? - Did you know that C++26 allows constexpr cast from
void*
? - Did you know that C++26 added
Member visit
? - Did you know that C++26 std.format added formatting pointers ability?
- Did you know that C++26 added 'A nice placeholder with no name'?
- Did you know that C++26 added user-generated static_assert messages?
- Did you know that C++26 added bind front and back to NTTP callables?
- Did you know that C++26 added `@, $, and `` to the basic character set?
C++23
- Did you know that C++23 added
std::invoke_r
? - Did you know that C++23 extended floating-point types?
- Did you know that C++23 deprecated std::aligned_storage and std::aligned_union?
- Did you know that C++23 added Monadic operations for std::expected?
- Did you know that C++23 added support for formatting ranges?
- Did you know that
std::unique_ptr
can be constexpr in C++23? - Did you know that C++23 added static operator[]?
- Did you know that functions in are constexpr since C++23?
- Did you know that C++23 added support for constexpr std::bitset?
- Did you know that C++23 added static operator()?
- Did you know that C++23 added
stacktrace
library? - Did you know that [[assume]] attribute has been accepted to C++23?
- Did you know that C++23 added
auto(x): decay-copy in the language
? - Did you know about C++23 ispanstream - A strstream replacement using span as buffer?
- Did you know that C++23 added
ranges::to
(conversion from ranges to containers)? - Did you know that C++23 added Literal Suffix for (signed) size_t?
- Did you know that C++23 added
bind_back
to simplify writing higher order functions? - Did you know about C++23 proposal
Structured Bindings can introduce a Pack
? - Did you know that C++23 added
std::to_underlying
? - Did you know that C++23 added
std::unreachable
? - Did you know that C++23 added Attributes on Lambda-Expressions?
- Did you know that C++23 added std::byteswap to swap bytes?
- Did you know that type_info equality operator is constexpr in C++23?
- Did you know that C++23 added Monadic operations for std::optional?
- Did you know that C++23 added std::move_only_function?
- Did you know that C++23 added basic_string::resize_and_overwrite?
- Did you know that C++23 allows extended init-statement with alias-declaration in the for loop?
- Did you know that CRTP can be implemented with C++23
Deducing this
? - Did you know that
Deducing this
proposal has been voted out into C++23? - Did you know that C++23 added
if consteval
? - Did you know about C++23 feature which adds support for inheriting from std::variant?
- Did you know about C++23 feature which removes unnecessary ()’s from C++ lambdas?
- Did you know that C++23 added
contains
function tostring_view
? - Did you know that C++23 added
is_scoped_enum
type trait to detect whether an enum is scoped? - Did you know about C++23 proposal to add
views::enumerate
? - Did you know that C++23 permitts static constexpr variables in constexpr functions?
- Did you know about proposal to add support for recursive lambdas?
- Did you know about proposal to add Compile Time Regular Expressions?
C++20
- Did you know about C++20
std::next_permutation
algorithm? - Did you know that C++20 added
std::span
? - Did you know that with C++20 you can pass concepts?
- Did you know about C++20
is_layout_compatible_v
type_traits? - Did you know that C++20 added support for Unevaluated asm-declaration in constexpr functions?
- Did you know that C++20 added support for constexpr std::vector?
- Did you know that C++20 concepts can be used to avoid implicit conversions?
- Did you know that C++20 introduced coroutines? (co_await)
- Did you know that C++20 introduced coroutines? (co_yield)
- Did you know that with C++20 (constexpr containers) TMP can be achieved with STL?
- Did you know about C++20 template specialization with concepts?
- Did you know about introduced in C++20
object concepts
? - Did you know that C++20 made
std::string
constexpr? - Did you know that C++20 added std::ranges::{all_of, any_of, none_of} algorithms?
- Did you know that C++20 added support for floating point values as non-type template parameters
- Did you know that C++20 added
std::erase_if
for std::map and std::vector? - Did you know that C++20 added
__VA_OPT__
for comma omission and comma deletion? - Did you know that C++20 extends support for data time utilities?
- Did you know that C++20 added
type_identity
which implements the identity metafunction? - Did you know that C++20
[[no_unique_address]]
can be used to implement lazy/fast/memory efficient - Did you know that C++20 made
typename
more optional? - Did you know that C++20
std::to_array
supports creating from string literals? - Did you know that C++20 added
Using Enum
which introduces the enumerator names of the named enumeratio - Did you know that C++20 added support for
[[no_unique_address]]
attribute? - Did you know that C++20 added support for
constexpr new
? - Did you know that C++20 added
ostream_joiner
that writes successive objects into the basic_ostr - Did you know that Formatted output has been accepted into C++20?
- Did you know C++2X Pattern Matching can be used for run-time dispatching?
- Did you know about C++2X Pattern Matching proposal?
- Did you know about the proposal to add Non-terminal variadic template parameters?
- Did you know about the proposal to add constexpr function parameters?
- Did you know about
Design By Introspection
? - Did you know that you can customize formatter for your classes with std::format?
- Did you know Non-Type Template Parameters (NTTP)?
- Did you know that static reflection supports introspecting constructors?
- Did you know that static reflection can be used to invoke functions with named parameters?
- Did you know that static reflection can be used to implement row polymorphism?
- Did you know that static reflection proposal for C++2X has mirror/value based interface?
- Did you know that static reflection proposal for C++2X can reflect functions?
- Did you know about static reflection proposal for C++2X?
- Did you know about the proposal to make printf compile-time safe and with named arguments?
- Did you know about proposal to introduce constexpr ternary operator?
- Did you know about the proposal to add json support to the standard library?
- Did you know about
std::expected
proposal for error handling? - Did you know that Lambdas in Unevaluated Context combined with Template Constraints (Concepts)?
- Did you know that Lambdas in Unevaluated Context combined with Immediately Invoked Function Expression?
- Did you know that Compile Time Regular Expressions support extracting matches?
- Did you know about C++2X
Pattern matching using is and as
proposal? - Did you know that tuple can be implement just with lambdas?
- Did you know that with concepts you can override a type?
- Did you know about (rejected) proposal for homogeneous variadic function parameters?
- Did you know that lambda expression is guaranteed to have a unique type?
- Did you know what is the underlying type of NTTP string aka
fixed_string
? - Did you know that lambdas are const by default but can be mutable and keep state?
- Did you know that concept can be passed via lambda expression?
C++17
- Did you know that run-time dispatching over type-list can be implemented many different ways?
- Did you know that you can simplify
boost.mp11
API with DSL? - Did you about C++17
std::index_sequence, std::make_index_sequence
? - Did you know that C++17 added
std::pmr::polymorphic_allocator
? - Did you know that C++17 added
std::forward_as_tuple
andstd::make_from_tuple
and what’s the differ - Did you know that C++17 [[nodiscard]] attribute can be applied not only to function?
- Did you know that C++17 structured bindings support to custom classes can be added?
- Did you know about C++17 variadic using declaration?
- Did you know that C++17 made exception specifications be part of the type system?
- Did you know about C++2X proposal to add Multidimensional subscript operator?
- Did you know that
std::variant
become valueless by exception? - Did you know about
std::rank/std::rank_v
type_trait to get the rank of the array? - Did you know that constexpr is strict about undefined behaviour (UB), object lifetime, etc?
- Did you know about
Policy Based Design
? - Did you know about python's named tuples?
- Did you know about typename erasure technique to reduce compilation times with templates?
- Did you know that mapping types to values is a simple way to transition from compile-time to run-time?
C++14
- Did you know that in C++ you can generate jump tables at compile-time?
- Did you know that C++ allows to pass Pointer To Member Function via template parameter?
- Did you know about
typename erasure
technique (via Strong/Opaque Typedefs) in C++? - Did you know about intrisincts to support SIMD (Single Instruction, Multiple Data) instructio
- Did you know DRY (Don’t Repeat Yourself) comparisons pattern?
- Did you know that you can implement a compile-time map with C++?
- Did you know about use cases for type-based
reserved
decorator? - Did you know about Automatic Dependency Injection libraries such as DI?
- Did you know that with Automatic DI production wiring can be overwritten for integration testing?
- Did you know that with Automatic DI one can control how dependencies are being created?
- Did you know about different ways of constructor Dependency Injection?
- Did you know that the JSON standard does not specify that the insertion order of object elements?
C++11
- Did you know that C++11 allows calling functions with reference-to-array parameters from an initialize
- Did you know that C++11 added a numeric literal operator template?
- Did you know the difference between fakes, stubs, mocks?
- Did you know that you can inject singletons to improve testability?
- Did you know about memoized for less types (more compile-time friendly) conditional_t?
- Did you know about gtest.gmock mocking framework?
- Did you know about methods to access the last element of variadic pack...?
- Did you know that different overloads can have different specifiers?
- Did you know that C++ allows accessing private members with friend injection?
- Did you know about variadic aggregate initialization?
- Did you know that default template arguments can be explored with template template arguments?
C++98
- Did you know about
virtual
inheritance in C++? - Did you know that the layout of struct fields will affect its size/alignment?
- Did you know that in C++
char
,signed char
andunsigned char
are 3 different types? - Did you know about function-try-block and that exceptions caught inside that block are implicitly
- Did you know that expression evaluation order is not specified?
- Did you know that
sizeof
operator can be used for efficient math computation? - Did you know about different ways of iterating over objects?
- Did you know about if/else hell anti-pattern?
- Did you know you can pass an array by reference?
- Did you know that ANSI/ISO C++ conforming programs must not rely on a maximum template depth?
- Did you know wrapping an unqualified function name?
- Did you know about compiler predefined macros assosicated with the compilation date/time?
- Did you know about different ways of accessing C-style arrays by index?
- Did you know that
using-declarator
can be used to manipulate the overload set?
GNU-extensions
- Did you know about
gnu::vector_size
extension? - Did you know about
__builtin_dump_struct
clang-extension which can nicely print a struct? - Did you know about [[gnu::cold]] function attribute to mark functions which are unlikely to be called?
Circle
- Did you know that Circle supports Python's extended slice syntax for variadic packs?
- Did you know that Circle Meta-model allows to convert string to a type?
- Did you know that Circle Meta-model allows for applying
normal
STL for operations on @meta types? - Did you know about C++2X proposal for the Circle Meta-model for compilation-time meta-progr
Disclaimer This repo orignates from https://quantlabfinancial.github.io/cpp_tip_of_the_week