#pragma once #include "../Tests.h" #include "AnotherUnit.h" #include #include class DeriveProtectedDtor { protected: ~DeriveProtectedDtor() {} }; class DLL_API QString { }; class DLL_API T1 { }; class DLL_API T2 { public: T2(); T2(int f); virtual ~T2(); int getField() const; void setField(int value); private: int field; }; class DLL_API Ignored { }; template class IndependentFields : public T1 { typedef T Type; public: IndependentFields(); IndependentFields(const IndependentFields& other); IndependentFields(const T& t); IndependentFields(T1* t1); IndependentFields(T2* t2); IndependentFields(float f); ~IndependentFields(); explicit IndependentFields(const std::map &other); float getIndependent(); T getDependent(const T& t); Type property(); static T staticDependent(const T& t); template void usesAdditionalDependentType(AdditionalDependentType additionalDependentType); static const int independentConst; private: float 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(T1* t1) : independent(1) { } template IndependentFields::IndependentFields(T2* t2) : independent(1) { } template IndependentFields::IndependentFields(float f) { independent = f; } template IndependentFields::IndependentFields(const std::map &v) : independent(1) { } template IndependentFields::~IndependentFields() { } template T IndependentFields::getDependent(const T& t) { return t; } template T IndependentFields::property() { return T(); } template T IndependentFields::staticDependent(const T& t) { return t; } template template void IndependentFields::usesAdditionalDependentType(AdditionalDependentType additionalDependentType) { } template float IndependentFields::getIndependent() { return independent; } template class DerivedChangesTypeName : public IndependentFields { }; template class DLL_API DependentValueFieldForArray { private: T field{}; }; template class Base { public: typedef T* typedefT; }; template class DependentValueFields : public Base { public: class Nested; class Nested { T field; }; DependentValueFields(); DependentValueFields(IndependentFields i); ~DependentValueFields(); DependentValueFields& returnInjectedClass(); DependentValueFields returnValue(); DependentValueFields operator+(const DependentValueFields& other); T getDependentValue(); void setDependentValue(const T& value); IndependentFields returnNestedInTemplate(); typename Base::typedefT typedefT() { return 0; } const T* returnTakeDependentPointer(const T* p); const T* propertyReturnDependentPointer(); void hasDefaultDependentParam(T* ptr, const T& refT = T()); typedef void (*DependentFunctionPointer)(T); DependentFunctionPointer dependentFunctionPointerField; private: T field{}; union { int unionField; }; }; template DependentValueFields::DependentValueFields() : unionField(0), dependentFunctionPointerField(0) { } template DependentValueFields::~DependentValueFields() { } template DependentValueFields::DependentValueFields(IndependentFields i) : DependentValueFields() { } template T DependentValueFields::getDependentValue() { return field; } template void DependentValueFields::setDependentValue(const T& value) { field = value; } template IndependentFields::Nested> DependentValueFields::returnNestedInTemplate() { return DependentValueFields::Nested(); } template const T* DependentValueFields::returnTakeDependentPointer(const T* p) { return p; } template const T* DependentValueFields::propertyReturnDependentPointer() { return 0; } template void DependentValueFields::hasDefaultDependentParam(T* ptr, const T& refT) { } template DependentValueFields& DependentValueFields::returnInjectedClass() { return *this; } template DependentValueFields DependentValueFields::returnValue() { return *this; } template DependentValueFields DependentValueFields::operator+(const DependentValueFields& other) { return DependentValueFields(); } class DLL_API DerivedFromSpecializationOfUnsupportedTemplate : public DependentValueFields { }; template class DependentPointerFields { public: DependentPointerFields(T* t = 0); ~DependentPointerFields(); T property(); T takeField(T t); T* field; }; template DependentPointerFields::DependentPointerFields(T* t) : field(t) { } template DependentPointerFields::~DependentPointerFields() { } template T DependentPointerFields::property() { return *field; } template T DependentPointerFields::takeField(T t) { return *field; } template class TwoTemplateArgs { public: class iterator { public: iterator(); ~iterator(); }; void takeDependentPtrToFirstTemplateArg(iterator i, const K& k); void takeDependentPtrToSecondTemplateArg(const V& v); private: K key; V value; }; template TwoTemplateArgs::iterator::iterator() { } template TwoTemplateArgs::iterator::~iterator() { } template void TwoTemplateArgs::takeDependentPtrToFirstTemplateArg(iterator i, const K& k) { } template void TwoTemplateArgs::takeDependentPtrToSecondTemplateArg(const V& v) { } 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); DependentValueFields returnTemplateWithRenamedTypeArg(const DependentValueFields& value); DependentValueFields propertyReturnsTemplateWithRenamedTypeArg(); private: T field{}; static T staticField; }; template <> class DLL_API HasDefaultTemplateArgument { public: bool property(); void setProperty(const bool& t); static bool staticProperty(); static void setStaticProperty(const bool& t); private: bool field; static bool staticField; }; 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 DependentValueFields HasDefaultTemplateArgument::returnTemplateWithRenamedTypeArg(const DependentValueFields& value) { return value; } template DependentValueFields HasDefaultTemplateArgument::propertyReturnsTemplateWithRenamedTypeArg() { return DependentValueFields(); } template T HasDefaultTemplateArgument::staticField; template class DerivesFromTemplateWithExplicitSpecialization : public HasDefaultTemplateArgument { public: DerivesFromTemplateWithExplicitSpecialization(); ~DerivesFromTemplateWithExplicitSpecialization(); }; template DerivesFromTemplateWithExplicitSpecialization::DerivesFromTemplateWithExplicitSpecialization() { } template DerivesFromTemplateWithExplicitSpecialization::~DerivesFromTemplateWithExplicitSpecialization() { } class DLL_API DerivesFromExplicitSpecialization : public DerivesFromTemplateWithExplicitSpecialization { }; template class InternalWithExtension { public: const T* extension(); }; template const T* InternalWithExtension::extension() { return 0; } template class TemplateWithIndexer { public: TemplateWithIndexer(); ~TemplateWithIndexer(); T& operator[](int i); T& operator[](const T& key); T& operator[](const char* string); private: T t[1]; HasDefaultTemplateArgument h; InternalWithExtension i; HasDefaultTemplateArgument specializationAsFieldOfAnother; }; template TemplateWithIndexer::TemplateWithIndexer() { } template TemplateWithIndexer::~TemplateWithIndexer() { } template T& TemplateWithIndexer::operator[](int i) { return t[0]; } template T& TemplateWithIndexer::operator[](const T& key) { return t[0]; } template T& TemplateWithIndexer::operator[](const char* string) { return t[0]; } template class OptionalTemplateArgs { }; template class VirtualTemplate { public: VirtualTemplate(); VirtualTemplate(IndependentFields i); VirtualTemplate(OptionalTemplateArgs optionalTemplateArgs); virtual ~VirtualTemplate(); virtual int function(); virtual T* function(T* t); DependentValueFields fieldWithSpecializationType; }; template VirtualTemplate::VirtualTemplate() { } template VirtualTemplate::VirtualTemplate(IndependentFields i) { } template VirtualTemplate::VirtualTemplate(OptionalTemplateArgs optionalTemplateArgs) { } template VirtualTemplate::~VirtualTemplate() { } template int VirtualTemplate::function() { return 5; } template T* VirtualTemplate::function(T* t) { return t; } template class VirtualDependentValueFields { public: VirtualDependentValueFields(); virtual ~VirtualDependentValueFields(); private: T t; }; template VirtualDependentValueFields::VirtualDependentValueFields() { } template VirtualDependentValueFields::~VirtualDependentValueFields() { } class DLL_API HasVirtualTemplate { public: VirtualTemplate getVCopy(); void setV(VirtualTemplate* value); int function(); private: VirtualTemplate* v; HasDefaultTemplateArgument explicitSpecialization; }; class DLL_API SpecializedInterfaceForMap : public InternalWithExtension { }; class DLL_API HasSpecializationForSecondaryBase : public DependentValueFields, public IndependentFields, public InternalWithExtension { }; template class TemplateInAnotherUnit; class DLL_API TemplateSpecializer { public: template class NestedTemplate { }; IndependentFields getIndependentFields(); void completeSpecializationInParameter(DependentValueFields p1, DependentValueFields p2, DependentValueFields p3); void completeSpecializationInParameter(TwoTemplateArgs p1, TwoTemplateArgs p2, TwoTemplateArgs p3, TwoTemplateArgs p4, TwoTemplateArgs p5); void completeSpecializationInParameter(TwoTemplateArgs::iterator p6, TwoTemplateArgs::iterator p7); VirtualTemplate returnSpecializedWithVoid(); 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; }; 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