Skip to main content

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.

2 votes
0 answers
184 views

This is my second iteration of implementing try_lock_for/try_lock_until function templates in which I've cherry-picked a bunch ...
Ted Lyngmo's user avatar
4 votes
2 answers
126 views

I implemented a templated vector_view class that holds a reference to an std::vector and provides the following operations: ...
Raghav Malik's user avatar
6 votes
1 answer
238 views

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 ...
GeometriaDifferenziale's user avatar
2 votes
1 answer
113 views

TL;DR https://godbolt.org/z/TMfb8z99h ...
Sergey Kolesnik's user avatar
2 votes
1 answer
124 views

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 ...
Loki Astari's user avatar
  • 97.7k
4 votes
2 answers
510 views

I recently had to work on some conversion of literal strings and wondered if that could be done at compile time using template meta programming. I couldn't find many examples online, so I started ...
adepierre's user avatar
  • 135
7 votes
2 answers
259 views

Prior Notification This follows a previous review of mine that addressed the core helper function named make_skippable. The composition implementation presented ...
mahush's user avatar
  • 115
3 votes
2 answers
182 views

(Please note: the post about the compose implementation announced below is now available.) This is about decorating callables by making their argument and return value to be a ...
mahush's user avatar
  • 115
3 votes
1 answer
128 views

Below is a piece of template code which allows for adding a Tag to structure or class types. ...
Sam Coutteau's user avatar
3 votes
1 answer
192 views

I was mad C++ did not have support for printing containers. I also could not find a header only library for printing containers so I decided to make my own. My goals were: 1) practicing templates 2) ...
Doruk's user avatar
  • 423
3 votes
1 answer
173 views

I have a class template that stores an std::optional<T>. A very reduced version of the class template looks like this: ...
joergbrech's user avatar
2 votes
1 answer
272 views

I've tried to make a small template for the creation of distinct (incompatible) numerical types. For example both row and column indices are usually represented as the same underlying type. However it ...
Sam Coutteau's user avatar
4 votes
1 answer
1k views

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 ...
adepierre's user avatar
  • 135
4 votes
0 answers
68 views

Sometimes I find I want to call a function passing each of a set of types as a template parameter, but without needing to construct an object of those types. I also may want to do this in multiple ...
John Ilacqua's user avatar
4 votes
2 answers
254 views

I want to do template metaprogramming to compute the conversion from std::variant<Ts...> to ...
Tom Huntington's user avatar

15 30 50 per page
1
2 3 4 5
19