Questions tagged [recursive-templates]

9 questions
3
votes
1 answer

Unable to recursively multiply BigInt beyond a certain number of iterations at compile-time in D

I need to get the product of an arbitrary number of variables. The actual number of variables and their values will be known at compile-time, however I cannot hardcode these because they come from reflection done on types at compile-time, using…
saxbophone
  • 779
  • 1
  • 6
  • 22
1
vote
1 answer

Sum integers using template recursion going upwards possible?

Using recursive templates, I would like to calculate the sum of the first n integers going from 0 to n. I.e. SumUp<10>::n would be 55. I wonder because I'm used to recursion going downwards (ie. from n to 0). Is it possible to go from 0 to n? Here's…
TMOTTM
  • 3,286
  • 6
  • 32
  • 63
1
vote
1 answer

How to show and hide sublists in a recursive ng-template in Angular?

I looked up a lot of different answers here but most of them are not accurate. So, I wanted to ask what a good approach would look like to show and hide lists (ul) but only the list which was clicked on via onclick. I have the following tempplate …
Operator
  • 37
  • 5
0
votes
0 answers

how does the recursive template deduction works

I read some complex template class design, it looks like recirsive template deduction with template parameter refers to the template itself. I simplified the codes as follow, does anybody can help explain how the template deduction works for the…
Jerry2102
  • 1
  • 2
0
votes
0 answers

variable template specialization does not support recursive definition

I'm compiling openVolumeMesh on visual studio 2017 using c++17, and it reports an internal compiler error in header "OpenVolumeMesh/IO/detail/ovmb_format.hh". I make a minimal reproduction here: #include enum class IntEncoding : uint8_t…
0
votes
1 answer

How to rewrite template function to allow code reuse

Consider the following template recursion function. Its purpose is to create a vector containing all values in the enum class EnumClassName for which its associated predicate function bool xxx() returns true. template
Daniel
  • 1
0
votes
0 answers

Tuple index out of bounds

I am trying to use Recursive Templates for calculating the sum of elements in a tuple. But i keep running into an error for tuple index out of bounds. error C2338: tuple index out of bounds template struct…
0
votes
3 answers
0
votes
0 answers

C++11 recursive templates

I want to achive the following behavior. In a base class I wish to have a container to store pointers to methods of derived class. (I want to store there h1 and h2). Base class is also implementing methods allowing to store those pointers and the…
stanleysts
  • 41
  • 3