Partial template specialization is a particular form of class template specialization. Usually used in reference to the C++ programming language, it allows the programmer to specialize only some arguments of a class template, as opposed to explicit specialization, where all the template arguments are provided.
Questions tagged [partial-specialization]
316 questions
0
votes
0 answers
why template with 2 parameters can't be specialized the same as with one parameter
I recently came across this very weird problem: if we have a template class like the one below:
template
class A
{
public:
void f(void);
void g(void);
};
and I want my f() function to be available for any type 'T', but I want…

Otringal
- 131
- 7
0
votes
2 answers
How to specialize a class for an inner type of a template?
I have a class that acts as a type trait, returning whether a certain condition is true. It's intended to mark classes as supporting a particular feature.
template struct Check : std::false_type { };
I have a template class that…

Myria
- 3,372
- 1
- 24
- 42
0
votes
1 answer
partial function template specialization
Hi I think I'm missing something with this technique. Tried to follow examples but the following gives me an error: invalid use of incomplete type ‘class Citizen’
template
class…
user4833046
0
votes
2 answers
Partial specialization for destructor
I am just working on my school homework, and I am interested if C++ could create specialized destructor for pointers. I know that this is not good practice, but because of performance, I want to do it this way. Also because I am curious about it. So…

Patrik Valkovič
- 706
- 7
- 26
0
votes
1 answer
SFINAE does not work as expected
I am reading this article and find this piece of code using SFINAE very interesting:
template
struct get_value_int {
template
…

Stoatman
- 758
- 3
- 9
- 22
0
votes
1 answer
In C++, why template function cannot have partial specialization?
Why C++ has this restriction, in other words, if template function could also be partially-specialized, does it lead to any ambiguity or implementation complexity?
Why it cannot act like template class?

Troskyvs
- 7,537
- 7
- 47
- 115
0
votes
2 answers
Multiple Partial specialization and full specialization required <> after type definition
I'm using an C++ "event" class that allowed one or two arguments in the to be called delegates.
Lately I've added support for delegates that don't require arguments, however when I specialze the class to use no template arguments I'm still required…

Stormenet
- 25,926
- 9
- 53
- 65
0
votes
0 answers
Two template arguments and specializations
I am trying to make a class template with two arguments.
Then I want to have the functions to be specialized.
template
class TestClass{
public:
TestClass(T x){
a = x;
z=number;
};
T…

GorAhl
- 61
- 7
0
votes
1 answer
Partial specialization of existing metafunction using mpl
Maybe I'm not all there today, but I'm wondering how to get this to work.
I'd like to partially specialize range_mutable_iterator and range_const_iterator from the boost library but only for specific types that I'd rather avoid mentioning…

Geoff
- 474
- 3
- 14
0
votes
0 answers
const double & in template class partial specialization
Suppose the following definitions:
#define AA(x) A
template
struct A;
template
struct A{};
template
struct A{};
template
struct A{};
extern…

AlwaysLearning
- 7,257
- 4
- 33
- 68
0
votes
1 answer
Specialize template from class to integer
I am playing with template specializations to learn their limits, and I was trying now not to specialize based on type, but using an integer parameter. But I am failing.
For instance, a template template should be specialized to have T for…

senseiwa
- 2,369
- 3
- 24
- 47
0
votes
1 answer
Create template class based on run time bool value
How can I implement below? I'd like to "pre-create" 2 "Doer" template class instances for bool values. Am I stuck with virtuals? what would be most efficient way to do something like this? I'm aware of boost variant, but not sure if that's the…

ggs
- 41
- 7
0
votes
1 answer
Specializing inner template of templated class
So I have a templated Image class, for which I am trying to set up inline color-conversions. This is a simplification of the code that is vexing me:
template
class Image {
/// ...
template

fish2000
- 4,289
- 2
- 37
- 76
0
votes
1 answer
Undefined reference to method of partially specialized class
I've been working on a set of template classes that represent various bits of geometry, and I realized that I would like to be able to specialize various classes to handle references and pointers e.g.
template
class rect{ // as in…

user4578093
- 231
- 1
- 3
- 10
0
votes
1 answer
Partial Specialization of class with two integer parameters
So I have a class that looks like this:
template
class AESLocker {
public:
//Default Constructor
AESLocker() : ENCRYPTION_KEY_LENGTH(N) {
//Blah blah
}
//Contructor
…

Mo Beigi
- 1,614
- 4
- 29
- 50