Questions tagged [template-meta-programming]
For code that uses templates to generate compile-time executed code. For ordinary use of templates, use the 'template' tag instead.
277 questions
2 votes
0 answers
182 views
Namespace-scope try_lock_for / try_lock_until pt. 2
This is my second iteration of implementing try_lock_for/try_lock_until function templates in which I've cherry-picked a bunch ...
6 votes
1 answer
236 views
A generic function that reads a line of numeric values from a file
I'm writing a library of IO functions for my physics laboratory class. In the meanwhile, I'm hoping to learn more about generic programming and C++20 concepts. Some context I usually came home from ...
2 votes
1 answer
117 views
Member detection within a class
Needed to do some Meta programming. I needed to check if a class has a specific member (one case a member variable second case a member type (two distinct use cases)). Since I am writing a library, I ...
7 votes
2 answers
258 views
Function composition in the context of data processing pipelines
Prior Notification This follows a previous review of mine that addressed the core helper function named make_skippable. The composition implementation presented ...
3 votes
1 answer
127 views
(C++) Template code for adding tagging types to add additional context
Below is a piece of template code which allows for adding a Tag to structure or class types. ...
3 votes
1 answer
172 views
Partial specialization of class template with minimal code duplication
I have a class template that stores an std::optional<T>. A very reduced version of the class template looks like this: ...
4 votes
1 answer
1k views
C++ enum to string conversion utility
I needed to find a way to convert a bunch of enums to string for displaying in C++. The two main ways I found when searching was using dark magic macros or voodoo magic template metaprogramming. As I ...
4 votes
2 answers
253 views
Transpose types variadicly
I want to do template metaprogramming to compute the conversion from std::variant<Ts...> to ...