Questions tagged [templates]
The templates tag has no summary.
130 questions
2 votes
4 answers
489 views
How to combine multiple functions into a single template based function
Threre are two functions FindMaxDistanceVector and FindMaxDistanceList whose implementation is almost same except some debug information added in FindMaxDistanceList. Note that these two functions are ...
0 votes
1 answer
110 views
Identify downsides: versioning auto-generated Terraform source code [closed]
HINT: the purpose of this question is to identify downsides for the scenario described. If something is a downside, then it should be quantifiable and it should clearly have a negative impact. ...
-1 votes
2 answers
206 views
Template Source Control Repository
What is the best practice, for creating a template repository, and then creating n projects based on that template? With "template" I mean: Let's say the template site is x. So x is a site ...
2 votes
1 answer
405 views
C++ behavior as a template argument
I would like to have a class, let's say a queue, that can be specialized to its behavior. For example, let them be a SafeQueue (which disables IRQs before any access) and a FastQueue (which doesn't). ...
1 vote
3 answers
4k views
Is it possible to instantiate a template class at runtime?
Suppose I have two abstract classes called Color and Animal And I can create classes Green/Red/Blue derived from Color and classes Dog/Cat/Pig derived from Animal at runtime using factory pattern. ...
1 vote
1 answer
237 views
C++20, specialize struct once per type and allow member functions to take type as reference, raw, std::unique|shared_ptr or any other smart ptr
Situation I have some existing functions which expect containers which can be iterated and which have certain value_type. The value_type can be a value or some (smart) pointer. All the value_type have ...
1 vote
3 answers
308 views
Design for generating/filling a document based on a template-file, while considering permissions from a database?
You have the backend for a web application. I'd like to keep this is as disconnected from specific programming lanuages as possible, but if necessary, assume we're talking about PHP. You need to write ...
1 vote
1 answer
193 views
Templates for generic code and code flexibility
I have a data which is a std::vector of a "small collection" of items of a given type struct Bunny {};. I was vague about "small collection" because for now it's a collection of ...