Top "Template-meta-programming" questions

Template meta-programming is a meta-programming technique in which templates are used by a compiler to generate temporary source code, which is merged by the compiler with the rest of the source code and then compiled.

Templated check for the existence of a class member function?

Is it possible to write a template that changes behavior depending on if a certain member function is defined on …

c++ templates template-meta-programming sfinae
How can you iterate over the elements of an std::tuple?

How can I iterate over a tuple (using C++11)? I tried the following: for(int i=0; i<std::tuple_…

c++ c++11 iteration template-meta-programming stdtuple
C++ templates Turing-complete?

I'm told that the template system in C++ is Turing-complete at compile time. This is mentioned in this post and …

c++ templates template-meta-programming turing-complete
What is the difference between a trait and a policy?

I have a class whose behavior I am trying to configure. template<int ModeT, bool IsAsync, bool IsReentrant> …

c++ template-meta-programming typetraits policy-based-design
Determine if a type is an STL container at compile time

I would like to write a template that will determine if a type is an stl container at compile time.   …

c++ templates stl template-meta-programming
Generating one class member per variadic template argument

I have a template class where each template argument stands for one type of value the internal computation can handle. …

c++ c++11 variadic-templates template-meta-programming
"too many template-parameter-lists" error when specializing a member function

I would like to define some template member methods inside a template class like so: template <typename T> …

c++ templates compiler-errors arguments template-meta-programming
details of std::make_index_sequence and std::index_sequence

I'm enjoying ramping up on variadic templates and have started fiddling about with this new feature. I'm trying to get …

c++ templates c++14 variadic-templates template-meta-programming
Generate random numbers in C++ at compile time

I'm trying to precompute random values using C++11's random library at compile time. I'm mostly following examples. What am …

c++ random c++11 template-meta-programming