Questions tagged [template-specialization]

Template specialization refers to programmer-generated explicit specialization of templates for specific types.

Templates refer to the ability to write code that works for any type satisfying the operations used within the class and/or function on that type. Template specialization refers to the ability for the programmer to explicitly change the code for a given type, either by a partial specializion of the template (in which a subset of parameters are specialized over), or a full specialization of the template (where all parameters are specialized).

1435 questions
-1
votes
1 answer

Function specialization doesn't work

I'm having a problem with writing a function specialization. template void is(type tab, int n) { string key; int i, j; for(i=1; i=0 && tab[j]>key){ …
photons3432
  • 5
  • 1
  • 7
-1
votes
1 answer

How to prevent a class template and its specializations in a header from being hijacked?

 The detailed request is to MAKE such a header file that contains such a class template and a bunch of its specializations(partial or fully), maybe several member functions of them have also been included. Then, as long as the developer didn't…
-2
votes
1 answer

How to Solve Django Error Message : TemplateDoesNotExist at

I am trying to do a project for a blog by django 3.1.2 , but unable to link the templates.I tried fixing it with **'DIRS': [os.path.join(BASE_DIR, 'templates'),]** I cannot find the logic miss. The template does exist and when I review the code, the…
-2
votes
1 answer

Template Class Specialization for Object Arguments

template class A { }; U x; A ... // OK A ... // ERROR If we can, then how do we make a specialization of class A whose argument is an object of any type?
AJ Tan
  • 51
  • 4
-2
votes
1 answer

Having trouble with user defined assignment operator for class template

#include #include "Register.h" int main() { // Basic constructors Reg8 r8{ 0xC4 }; Reg16 r16{ 0x1234 }; Reg32 r32{ 0x89ABCDEF }; Reg64 r64{ 0xABBA04200240ABBA }; // I can do this with similar types: Reg8 …
-2
votes
2 answers

Implementing partial template specialization of template template parameter

I am having problems implementing the specialization of a class template that uses template template parameters. For example, I would like to write a class that is used for sorting: template