Your weekly dose of modern C++ challenge (Release every
Sunday
).
-
https://tip-of-the-week.github.io/cpp
-
How to contribute/add a solution?
- Contributions are always very much appreciated. Just create a Pull Request with your solution.
- [345] - Did you know that C++26 allows constexpr cast from
void*
? - [344] - Did you know that C++26 added
Member visit
? - [343] - Did you know that C++26 std.format added formatting pointers ability?
- [342] - Did you know that C++26 added 'A nice placeholder with no name'?
- [341] - Did you know that C++26 added user-generated static_assert messages?
- [340] - Did you know that C++26 added bind front and back to NTTP callables?
- [339] - Did you know that C++26 added `@, $, and `` to the basic character set?
- [338] - Did you know about C++20
std::next_permutation
algorithm? - [337] - Did you know that run-time dispatching over type-list can be implemented many different ways?
- [336] - Did you know about
gnu::vector_size
extension? - [335] - Did you know that you can simplify
boost.mp11
API with DSL? - [334] - Did you know that C++23 added
std::invoke_r
? - [333] - Did you know that C++20 added
std::span
? - [332] - Did you know that in C++ you can generate jump tables at compile-time?
- [331] - Did you about C++17
std::index_sequence, std::make_index_sequence
? - [330] - Did you know that C++17 added
std::pmr::polymorphic_allocator
? - [329] - Did you know that C++ allows to pass Pointer To Member Function via template parameter?
- [328] - Did you know that C++23 extended floating-point types?
- [327] - Did you know that C++17 added
std::forward_as_tuple
andstd::make_from_tuple
and what’s the differ - [326] - Did you know that C++23 deprecated std::aligned_storage and std::aligned_union?
- [325] - Did you know about
typename erasure
technique (via Strong/Opaque Typedefs) in C++? - [324] - Did you know about
virtual
inheritance in C++? - [323] - Did you know that constexpr is strict about undefined behaviour (UB), object lifetime, etc?
- [322] - Did you know that C++23 added Monadic operations for std::expected?
- [321] - Did you know that C++23 added support for formatting ranges?
- [320] - Did you know about intrisincts to support SIMD (Single Instruction, Multiple Data) instructio
- [319] - Did you know that C++11 allows calling functions with reference-to-array parameters from an initialize
- [318] - Did you know that
std::unique_ptr
can be constexpr in C++23? - [317] - Did you know that with C++20 you can pass concepts?
- [316] - Did you know about
std::rank/std::rank_v
type_trait to get the rank of the array? - [315] - Did you know about C++20
is_layout_compatible_v
type_traits? - [314] - Did you know that with gnu:C++26 a more parts of static reflection can be emulated?
- [313] - Did you know that C++26 added #embed?
- [312] - Did you know that C++20 added support for Unevaluated asm-declaration in constexpr functions?
- [311] - Did you know DRY (Don’t Repeat Yourself) comparisons pattern?
- [310] - Did you know that C+23 permitts static constexpr variables in constexpr functions?
- [309] - Did you know that C++20 added support for constexpr std::vector?
- [308] - Did you know that the layout of struct fields will affect its size/alignment?
- [307] - Did you know that C++23 added static operator[]?
- [306] - Did you know about if/else hell anti-pattern?
- [305] - Did you know about (rejected) proposal for homogeneous variadic function parameters?
- [304] - Did you know that tuple can be implement just with lambdas?
- [303] - Did you know about typename erasure technique to reduce compilation times with templates?
- [302] - Did you know that with concepts you can override a type?
- [301] - Did you know that functions in are constexpr since C++23?
- [300] - Did you know that C++23 added support for constexpr std::bitset?
- [299] - Did you know that C++20 concepts can be used to avoid implicit conversions?
- [298] - Did you know that C++23 added static operator()?
- [297] - Did you know that C++20 introduced coroutines? (co_await)
- [296] - Did you know that C++20 introduced coroutines? (co_yield)
- [295] - Did you know that C++23 added
stacktrace
library? - [294] - Did you know that with C++20 (constexpr containers) TMP can be achieved with STL?
- [293] - Did you know that C++17 [[nodiscard]] attribute can be applied not only to function?
- [292] - Did you know about memoized for less types (more compile-time friendly) conditional_t?
- [291] - Did you know about [[gnu::cold]] function attribute to mark functions which are unlikely to be called?
- [290] - Did you know that lambda expression is guaranteed to have a unique type?
- [289] - Did you know that [[assume]] attribute has been accepted to C++23?
- [288] - Did you know you can pass an array by reference?
- [287] - Did you know that C++23 added
auto(x): decay-copy in the language
? - [286] - Did you know that Circle supports Python's extended slice syntax for variadic packs?
- [285] - Did you know about C++20 template specialization with concepts?
- [284] - Did you know about C++23 ispanstream - A strstream replacement using span as buffer?
- [283] - Did you know that C++23 added
ranges::to
(conversion from ranges to containers)? - [282] - Did you know about introduced in C++20
object concepts
? - [281] - Did you know about gtest.gmock mocking framework?
- [280] - Did you know about use cases for type-based
reserved
decorator? - [279] - Did you know that C++20 made
std::string
constexpr? - [278] - Did you know that C++23 added Literal Suffix for (signed) size_t?
- [277] - Did you know that C++17 structured bindings support to custom classes can be added?
- [276] - Did you know that C++23 added
bind_back
to simplify writing higher order functions? - [275] - Did you know what is the underlying type of NTTP string aka
fixed_string
? - [274] - Did you know about C++23 proposal
Structured Bindings can introduce a Pack
? - [273] - Did you know that concept can be passed via lambda expression?
- [272] - Did you know that C++20 added std::ranges::{all_of, any_of, none_of} algorithms?
- [271] - Did you know that C++20 added support for floating point values as non-type template parameters
- [270] - Did you know that C++23 added
std::to_underlying
? - [269] - Did you know about
boost::mp11::mp_with_index
? - [268] - Did you know that C++20 added
std::erase_if
for std::map and std::vector? - [267] - Did you know that C++23 added
std::unreachable
? - [266] - Did you know wrapping an unqualified function name in parentheses suppresses argument-d
- [265] - Did you know that C++23 added Attributes on Lambda-Expressions?
- [264] - Did you know that C++20 added
__VA_OPT__
for comma omission and comma deletion? - [263] - Did you know that C++23 added std::byteswap to swap bytes?
- [262] - Did you know that type_info equality operator is constexpr in C++23?
- [261] - Did you know that C++23 added Monadic operations for std::optional?
- [260] - Did you know that C++23 added std::move_only_function?
- [259] - Did you know that static reflection supports introspecting constructors?
- [258] - Did you know that static reflection can be used to invoke functions with named parameters?
- [257] - Did you know that static reflection can be used to implement row polymorphism?
- [256] - Did you know that static reflection proposal for C++2X has mirror/value based interface?
- [255] - Did you know that static reflection proposal for C++2X can reflect functions?
- [254] - Did you know about static reflection proposal for C++2X?
- [253] - Did you know that C++20 extends support for data time utilities?
- [252] - Did you know that C++23 added basic_string::resize_and_overwrite?
- [251] - Did you know that C++20 added
type_identity
which implements the identity metafunction? - [250] - Did you know about methods to access the last element of variadic pack...?
- [249] - Did you know that C++23 allows extended init-statement with alias-declaration in the for loop?
- [248] - Did you know that CRTP can be implemented with C++23
Deducing this
? - [247] - Did you know that
Deducing this
proposal has been voted out into C++23? - [246] - Did you know that C++11 added a numeric literal operator template?
- [245] - Did you know about C++2X proposal to add Multidimensional subscript operator?
- [244] - Did you know about compiler predefined macros assosicated with the compilation date/time?
- [243] - Did you know about C++2X
Pattern matching using is and as
proposal? - [242] - Did you know that ANSI/ISO C++ conforming programs must not rely on a maximum template depth greater th
- [241] - Did you know about different ways of accessing C-style arrays by index?
- [240] - Did you know that
using-declarator
can be used to manipulate the overload set? - [239] - Did you know that Circle Meta-model allows to convert string to a type?
- [238] - Did you know that Circle Meta-model allows for applying
normal
STL for operations on @meta types? - [237] - Did you know about C++2X proposal for the Circle Meta-model for compilation-time meta-progr
- [236] - Did you know about
__builtin_dump_struct
clang-extension which can nicely print a struct? - [235] - Did you know that C++20
[[no_unique_address]]
can be used to implement lazy/fast/memory efficient - [234] - Did you know about function-try-block and that exceptions caught inside that block are implicitly
- [233] - Did you know that C++20 made
typename
more optional? - [232] - Did you know that different overloads can have different specifiers?
- [231] - Did you know about C++17 variadic using declaration?
- [230] - Did you know that C++23 added
if consteval
? - [229] - Did you know about python's named tuples?
- [228] - Did you know that C++ allows accessing private members with friend injection?
- [227] - Did you know that
std::variant
become valueless by exception? - [226] - Did you know about C++23 feature which adds support for inheriting from std::variant?
- [225] - Did you know about C++23 feature which removes unnecessary ()’s from C++ lambdas?
- [224] - Did you know that the JSON standard does not specify that the insertion order of object elements s
- [223] - Did you know about the proposal to add json support to the standard library?
- [222] - Did you know that C++23 added
contains
function tostring_view
? - [221] - Did you know that with Automatic DI production wiring can be overwritten for integration testing?
- [220] - Did you know that with Automatic DI one can control how dependencies are being created?
- [219] - Did you know about Automatic Dependency Injection libraries such as DI?
- [218] - Did you know about different ways of constructor Dependency Injection?
- [217] - Did you know the difference between fakes, stubs, mocks?
- [216] - Did you know that you can inject singletons to improve testability?
- [215] - Did you know C++2X Pattern Matching can be used for run-time dispatching?
- [214] - Did you know about variadic aggregate initialization?
- [213] - Did you know that mapping types to values is a simple way to transition from compile-time to run-time s
- [212] - Did you know that lambdas are const by default but can be mutable and keep state?
- [211] - Did you know about C++2X Pattern Matching proposal?
- [210] - Did you know about
Design By Introspection
? - [209] - Did you know about
Policy Based Design
? - [208] - Did you know that default template arguments can be explored with template template arguments?
- [207] - Did you know about the proposal to add constexpr function parameters?
- [206] - Did you know about proposal to add support for recursive lambdas?
- [205] - Did you know that C++20
std::to_array
supports creating from string literals? - [204] - Did you know that you can implement a compile-time map with C++?
- [203] - Did you know that in C++
char
,signed char
andunsigned char
are 3 different types? - [202] - Did you know that C++20 added
Using Enum
which introduces the enumerator names of the named enumeratio - [201] - Did you know that
sizeof
operator can be used for efficient math computation? - [200] - Did you know that C++23 added
is_scoped_enum
type trait to detect whether an enum is scoped? - [199] - Did you know about proposal to introduce constexpr ternary operator?
- [198] - Did you know about different ways of iterating over objects?
- [197] - Did you know that Lambdas in Unevaluated Context combined with Template Constraints (Concepts) can be use
- [196] - Did you know that Lambdas in Unevaluated Context combined with Immediately Invoked Function Expression
- [195] - Did you know that C++20 added support for
[[no_unique_address]]
attribute? - [194] - Did you know about C++23 proposal to add
views::enumerate
? - [193] - Did you know that C++20 added support for
constexpr new
? - [192] - Did you know about
std::expected
proposal for error handling? - [191] - Did you know that expression evaluation order is not specified?
- [190] - Did you know that C++20 added
ostream_joiner
that writes successive objects into the basic_ostr - [189] - Did you know that Compile Time Regular Expressions support extracting matches?
- [188] - Did you know about proposal to add Compile Time Regular Expressions?
- [187] - Did you know that C++17 made exception specifications be part of the type system?
- [186] - Did you know Non-Type Template Parameters (NTTP) with User-Defined Literals (UDL) can be used to get com
- [185] - Did you know about the proposal to make printf compile-time safe and with named arguments?
- [184] - Did you know that you can customize formatter for your classes with std::format?
- [183] - Did you know that Formatted output has been accepted into C++20?
- [182] - Did you know about the proposal to add Non-terminal variadic template parameters?
- ...
Disclaimer This repo orignates from https://quantlabfinancial.github.io/cpp_tip_of_the_week