test_structs.hpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. // (C) Copyright Edward Diener 2011,2012
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #if !defined(TEST_STRUCTS_HPP)
  6. #define TEST_STRUCTS_HPP
  7. struct AType
  8. {
  9. // Type
  10. typedef int AnIntType;
  11. struct AStructType
  12. {
  13. template <class> struct MStrMemberTemplate { };
  14. template<class X,class Y,short AA> static int StatFuncTemplate(X *,Y) { int ret(AA); return ret; }
  15. };
  16. typedef int & AnIntTypeReference;
  17. struct BType
  18. {
  19. typedef int AnIntegerType;
  20. struct CType
  21. {
  22. typedef int AnotherIntegerType;
  23. template <class,class,int,short,class,template <class,int> class,class> struct CTManyParameters { };
  24. template<class X,class Y,class Z,short AA> double SomeFuncTemplate(X,Y *,Z &) { double ret(AA); return ret; }
  25. };
  26. };
  27. // Template
  28. template <class> struct ATPMemberTemplate { };
  29. template <int> struct AMemberTemplate { };
  30. template <int,int> struct AnotherMemberTemplate { };
  31. template <class,class> struct CLMemberTemplate { };
  32. // Data
  33. int AnInt;
  34. BType IntBT;
  35. BType::CType NestedCT;
  36. // Function
  37. void VoidFunction() { }
  38. int IntFunction() { return 0; }
  39. // Const function
  40. double AConstFunction(long, char) const { return 2.57; }
  41. void WFunction(float, double = 4.3) const { }
  42. // Volatile function
  43. double AVolatileFunction(long, char = 'c') volatile { return 2.58; }
  44. void VolFunction(float, double) volatile { }
  45. // Const Volatile function
  46. double ACVFunction(long, char) const volatile { return 2.59; }
  47. void ConstVolFunction(float, double) const volatile { }
  48. // Function Templates
  49. template<class X,int Y> int AFuncTemplate(const X &) { return Y; }
  50. template<class X,class Y,class Z> void AFuncTemplate(X *,Y,Z &) { }
  51. // Static Data
  52. static short DSMember;
  53. // Static Function
  54. static int SIntFunction(long,double) { return 2; }
  55. // Static Function Template
  56. template<class X,class Y,class Z> static void AnotherFuncTemplate(X,Y &,const Z &) { }
  57. };
  58. struct AnotherType
  59. {
  60. // Type
  61. typedef AType::AnIntType someOtherType;
  62. // Template
  63. template <class,class,class,class,class,class> struct SomeMemberTemplate { };
  64. template <class,class,int,class,template <class> class,class,long> struct ManyParameters { };
  65. template <class,class,class,class> struct SimpleTMP { };
  66. // Data
  67. bool aMember;
  68. bool cMem;
  69. long AnInt;
  70. AType OtherAT;
  71. AType::AStructType ONestStr;
  72. // Function
  73. AType aFunction(int = 7) { return AType(); }
  74. int anotherFunction(AType) { return 0; }
  75. AType::AnIntType sFunction(int,long = 88,double = 1.0) { return 0; }
  76. double IntFunction(int = 9922) { return 0; }
  77. // Const function
  78. int AnotherConstFunction(AType *, short) const { return 0; }
  79. AType StillSame(int) const { return OtherAT; }
  80. // Volatile function
  81. int AnotherVolatileFunction(AType *, short) volatile { return 0; }
  82. bool StillVolatile(int) volatile { return false; }
  83. // Const Volatile function
  84. int AnotherConstVolatileFunction(AType *, short) const volatile { return 0; }
  85. short StillCV(int = 3) const volatile { return 32; }
  86. // Function Templates
  87. template<class X> long MyFuncTemplate(X &) { return 0; }
  88. // Static Function
  89. static AType TIntFunction(long,double = 3.0) { return AType(); }
  90. static AType::AStructType TSFunction(AType::AnIntType,double) { return AType::AStructType(); }
  91. // Static Data
  92. static AType::AStructType AnStat;
  93. // Static Function Template
  94. template<class X,class Y> static void YetAnotherFuncTemplate(const X &,Y &) { }
  95. static const int CIntValue = 10;
  96. };
  97. struct MarkerType
  98. {
  99. };
  100. short AType::DSMember(5622);
  101. AType::AStructType AnotherType::AnStat;
  102. #endif // TEST_STRUCTS_HPP