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
1
vote
1 answer
Class partial template specialization for single function, how to solve undefined error of other members
I have the following template class. I need to specialize the alloc function for some specific outT case.
template
class Filter {
public:
typedef inT InputType;
typedef outT OutputType;
struct Options {
int…

manatttta
- 3,054
- 4
- 34
- 72
1
vote
1 answer
How a specialization of remove_reference is selcted
Remove_reference is defined as follows:
template< class T > struct remove_reference {typedef T type;};
template< class T > struct remove_reference {typedef T type;};
template< class T > struct remove_reference {typedef T type;}; …

esam
- 580
- 3
- 13
1
vote
3 answers
Pairwise bool and in c++ template
I am writing a template that takes a arbitrary number of arguments and find the Boolean AND on these value.
template struct meta_bool_and;
template struct meta_bool_and : std::integral_constant {};
template

Jes
- 2,614
- 4
- 25
- 45
1
vote
3 answers
Template template and partial specialization: a puzzle
Consider the following code:
template
struct S { };
template
struct B;
template class C>
struct B> {
void f() { }
};
int main() {
B

skypjack
- 49,335
- 19
- 95
- 187
1
vote
1 answer
how to partially specialize a templated c++ class?
I wrote a generic matrix class like so:
template
class CMatrix
{
protected:
T* m_elem;
public:
CMatrix() : m_elem(new T[N*M]) {}
~CMatrix() { delete[] m_elem; }
inline bCMatrix&…

Dominic Hofer
- 5,751
- 4
- 18
- 23
1
vote
1 answer
Specialized friend function in C++
I have a function template foo that has to perform different computations depending on whether the template parameter is a real or a complex number. In any case, the result will be a real number, e.g. double, even if the template parameter is…

cthl
- 409
- 2
- 9
1
vote
2 answers
Specialize member template struct by template parameters of class
I have a class like
template
class TEST {
public:
template struct test { static __forceinline void Run() { std::cout << 0 << std::endl; } };
template struct test

Kozuki
- 97
- 8
1
vote
1 answer
Static template member function for template class
I have a template class and a template member function:
template
struct A{
template
static int f(){return 0;}
};
I want to specialize for a case when T1 and T2 are the same,
For example, define the case A::f for…

alfC
- 14,261
- 4
- 67
- 118
1
vote
2 answers
error: invalid use of incomplete type (Maybe a definition issue)
I've been struggling with this issue for a while and can't seem to get it right with all the templates and specializations. I think I'm missing a definition of the static function internal_set_BC but I'm not sure. When I compile the code below, I…

Fahad Alrashed
- 1,272
- 2
- 11
- 17
1
vote
2 answers
partial specialization of a static const member variable
Currently, I've implemented a template class Mat that's a wrapper around the matrix class of a third party library (T is the type of the components: double, int, etc.). Now, I wish to implement a Tensor class uses one Mat for storage and a second…

Luis Negrete
- 43
- 1
- 6
1
vote
1 answer
Issue with class template partial specialization
I've been trying to implement a function that needs partial template specializations and fallen back to the static struct technique, and I'm having a number of problems.
template struct PushImpl {
…

Puppy
- 144,682
- 38
- 256
- 465
1
vote
2 answers
Partial function/method template specialization workarounds
I know partial template specialization isn't supported for functions and class methods, so my question is: What are common solutions or patterns to resolve this? Below Derived derives from Base, and both of these classes have virtual methods…

Agrim Pathak
- 3,047
- 4
- 27
- 43
1
vote
1 answer
Specializing nested templates
I have a class template A which looks like this. Consider TImpl1 and TImpl2 as arguments that define the implementations of abstract data types B and C to solve a problem that belongs to A:
template
user4270861
1
vote
1 answer
Partial template specialization for partial template parameter application not working GCC 4.8.1
At the root of my policy-based class lies a container adapter that provides an interface for conversion between different containers. It is parametrized by a type T and template template parameter Container. In order to make it work with standard…

tsuki
- 907
- 4
- 17
1
vote
1 answer
C++ partial specialization in source file
I have a problem concerning partial class template specialization in c++. I have one class A with two templates T,U. Then i want two class specializations with exclusive methods print_me(), only visible for those two specializations. Apart from that…

Peter Power
- 121
- 3
- 7