#include "../Tests.h" #include "AnotherUnit.h" #include class DLL_API T1 { public: T1(); T1(int f); ~T1(); int getField() const; private: int field; }; class DLL_API T2 { }; template class DLL_API IndependentFields : public T1 { public: IndependentFields(); IndependentFields(const IndependentFields& other); IndependentFields(const T& t); IndependentFields(int i); ~IndependentFields(); int getIndependent(); const T* returnTakeDependentPointer(const T* p); T getDependent(const T& t); static T staticDependent(const T& t); template void usesAdditionalDependentType(AdditionalDependentType additionalDependentType); static const int independentConst; private: int independent; }; template const int IndependentFields::independentConst = 15; template IndependentFields::IndependentFields() : independent(1) { } template IndependentFields::IndependentFields(const IndependentFields& other) { independent = other.independent; } template IndependentFields::IndependentFields(const T& t) : independent(1) { } template IndependentFields::IndependentFields(int i) { independent = i; } template IndependentFields::~IndependentFields() { } template const T* IndependentFields::returnTakeDependentPointer(const T* p) { return p; } template T IndependentFields::getDependent(const T& t) { return t; } template T IndependentFields::staticDependent(const T& t) { return t; } template int IndependentFields::getIndependent() { return independent; } template class DerivedChangesTypeName : public IndependentFields { }; template class DLL_API DependentValueFieldForArray { private: T field; }; template class DLL_API DependentValueFields { public: class Nested { }; DependentValueFields(); ~DependentValueFields(); DependentValueFields& returnInjectedClass(); DependentValueFields returnValue(); DependentValueFields operator+(const DependentValueFields& other); T getDependentValue(); void setDependentValue(const T& value); private: T field; union { int unionField; }; }; template DependentValueFields::DependentValueFields() { } template DependentValueFields::~DependentValueFields() { } template T DependentValueFields::getDependentValue() { return field; } template void DependentValueFields::setDependentValue(const T& value) { field = value; } template DependentValueFields& DependentValueFields::returnInjectedClass() { return *this; } template DependentValueFields DependentValueFields::returnValue() { return *this; } template DependentValueFields DependentValueFields::operator+(const DependentValueFields& other) { DependentValueFields sum; sum.field = field + other.field; return sum; } template class DLL_API DependentPointerFields { private: T* field; }; template class TwoTemplateArgs { private: K key; V value; }; template > class HasDefaultTemplateArgument { public: HasDefaultTemplateArgument(); ~HasDefaultTemplateArgument(); T property(); void setProperty(const T& t); static T staticProperty(); static void setStaticProperty(const T& t); bool operator==(const HasDefaultTemplateArgument& other); private: T field; static T staticField; }; template <> class HasDefaultTemplateArgument { public: HasDefaultTemplateArgument(); ~HasDefaultTemplateArgument(); bool property(); void setProperty(const bool& t); static bool staticProperty(); static void setStaticProperty(const bool& t); private: bool field; static bool staticField; }; template class TemplateWithIndexer { public: TemplateWithIndexer(); T& operator[](int i); T& operator[](const char* string); private: T t[1]; }; template TemplateWithIndexer::TemplateWithIndexer() { } template T& TemplateWithIndexer::operator[](int i) { return t[0]; } template T& TemplateWithIndexer::operator[](const char* string) { return t[0]; } template HasDefaultTemplateArgument::HasDefaultTemplateArgument() { } template HasDefaultTemplateArgument::~HasDefaultTemplateArgument() { } template T HasDefaultTemplateArgument::property() { return field; } template void HasDefaultTemplateArgument::setProperty(const T& t) { field = t; } template T HasDefaultTemplateArgument::staticProperty() { return staticField; } template void HasDefaultTemplateArgument::setStaticProperty(const T& t) { staticField = t; } template bool HasDefaultTemplateArgument::operator==(const HasDefaultTemplateArgument& other) { return field == other.field; } template T HasDefaultTemplateArgument::staticField; template class VirtualTemplate { public: VirtualTemplate(); virtual ~VirtualTemplate(); virtual int function(); }; template VirtualTemplate::VirtualTemplate() { } template VirtualTemplate::~VirtualTemplate() { } template int VirtualTemplate::function() { return 5; } class DLL_API HasVirtualTemplate { public: HasVirtualTemplate(); ~HasVirtualTemplate(); VirtualTemplate getVCopy(); void setV(VirtualTemplate* value); int function(); private: VirtualTemplate* v; HasDefaultTemplateArgument explicitSpecialization; }; template class TemplateInAnotherUnit; class DLL_API TemplateSpecializer { public: TemplateSpecializer(); template class NestedTemplate { }; IndependentFields getIndependentFields(); private: IndependentFields independentFields; DependentValueFields dependentValueFields; DependentPointerFields dependentPointerFields; HasDefaultTemplateArgument hasDefaultTemplateArgument; DependentValueFields dependentPointerFieldsT1; DependentValueFields dependentPointerFieldsT2; TemplateInAnotherUnit templateInAnotherUnit; DependentValueFields> specializeWithSpecialization; DependentValueFields> specializeWithSameSpecialization; NestedTemplate nestedTemplate; DependentValueFields> nestedDependentPointer1; DependentValueFields> nestedDependentPointer2; DependentValueFieldForArray dependentFieldArray; void completeSpecializationInParameter(DependentValueFields p1, DependentValueFields p2, DependentValueFields p3); void completeSpecializationInParameter(TwoTemplateArgs p1, TwoTemplateArgs p2, TwoTemplateArgs p3); }; template class PartiallySpecialized { }; template class PartiallySpecialized { union { int i; float f; }; }; template class HasResultType { typedef char Yes; typedef void *No; template static Yes test(int, const typename U::result_type * = 0); template static No test(double); public: enum { Value = (sizeof(test(0)) == sizeof(Yes)) }; }; template ::Value> struct LazyResultType { typedef typename Functor::result_type Type; }; template struct LazyResultType { typedef void Type; }; template struct MapResultType { typedef typename LazyResultType::Type ResultType; }; template