When documenting a member of a templated class, Doxygen documents the default implementation but not any specializations (or even more confusingly - the first specialization, but not any others, when there's no default).
template<FooClassType T>
class FooClass {
public:
/**
* A value depending on the templated type.
*/
static const int nFooValue;
};
#endif
FooClass.cpp
#include "FooClass.h"
template<>
const int FooClass<FooClassType::Type_A>::nFooValue = 1;
template<>
const int FooClass<FooClassType::Type_B>::nFooValue = 2;
In this case, I'd simply get a docpage for FooClass<FooClassType T>, documenting FooClass<FooClassType T>::nFooValue as being 1. Not what I want…
Is there any way to produce documentation which lists all specializations in the documentation of FooClass<T>::nFooValue? Or perhaps to produce seperate pages for FooClass<Type_A>, FooClass<Type_B>?
Thanks much,
Ziv
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, I've understood the problem. My bad, clearly - this isn't a problem with doxygen, it's my code that's wrong. Compiles and runs fine in my local environment, but still wrong!
template<FooClassType T>
class FooClass {
public:
/**
* A value depending on the templated type.
*/
static const int nFooValue;
};
template<>
class FooClass<Type_A> {
public:
static const int nFooValue;
};
template<>
class FooClass<Type_B> {
public:
static const int nFooValue;
};
#endif
Without explicitly declaring the template specialization, the code is not well-defined (and cpp files calling FooClass<Type_A> don't know to look for a specialization).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Seems my original code was correct after all, except I should have declared the specialization in the headers. So doxygen is fialing to document members it should, and I find that this bug has been previously noted, and apparantly not been fixed yet.
Thanks much!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When documenting a member of a templated class, Doxygen documents the default implementation but not any specializations (or even more confusingly - the first specialization, but not any others, when there's no default).
For example:
enum FooClassType {Type_A, Type_B};
template<FooClassType T>
class FooClass {
public:
/**
* A value depending on the templated type.
*/
static const int nFooValue;
};
#endif
template<>
const int FooClass<FooClassType::Type_A>::nFooValue = 1;
template<>
const int FooClass<FooClassType::Type_B>::nFooValue = 2;
In this case, I'd simply get a docpage for FooClass<FooClassType T>, documenting FooClass<FooClassType T>::nFooValue as being 1. Not what I want…
Is there any way to produce documentation which lists all specializations in the documentation of FooClass<T>::nFooValue? Or perhaps to produce seperate pages for FooClass<Type_A>, FooClass<Type_B>?
Thanks much,
Ziv
OK, I've understood the problem. My bad, clearly - this isn't a problem with doxygen, it's my code that's wrong. Compiles and runs fine in my local environment, but still wrong!
My header file should have read as follows:
enum FooClassType {Type_A, Type_B};
template<FooClassType T>
class FooClass {
public:
/**
* A value depending on the templated type.
*/
static const int nFooValue;
};
template<>
class FooClass<Type_A> {
public:
static const int nFooValue;
};
template<>
class FooClass<Type_B> {
public:
static const int nFooValue;
};
#endif
Without explicitly declaring the template specialization, the code is not well-defined (and cpp files calling FooClass<Type_A> don't know to look for a specialization).
Seems my original code was correct after all, except I should have declared the specialization in the headers. So doxygen is fialing to document members it should, and I find that this bug has been previously noted, and apparantly not been fixed yet.
Thanks much!