From c0cdb2ad99a1e2a6ade5ce76c91177a79258e669 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:10:11 +0200 Subject: 3.14 --- shared/loki/HierarchyGenerators.h | 374 +++++++++++++++++++------------------- 1 file changed, 187 insertions(+), 187 deletions(-) (limited to 'shared/loki/HierarchyGenerators.h') diff --git a/shared/loki/HierarchyGenerators.h b/shared/loki/HierarchyGenerators.h index 3fa11ffc..83ec194c 100644 --- a/shared/loki/HierarchyGenerators.h +++ b/shared/loki/HierarchyGenerators.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_HIERARCHYGENERATORS_INC_ @@ -25,8 +25,8 @@ namespace Loki { #if defined(_MSC_VER) && _MSC_VER >= 1300 -#pragma warning( push ) - // 'class1' : base-class 'class2' is already a base-class of 'class3' +#pragma warning( push ) +// 'class1' : base-class 'class2' is already a base-class of 'class3' #pragma warning( disable : 4584 ) #endif // _MSC_VER @@ -35,180 +35,180 @@ namespace Loki // Generates a scattered hierarchy starting from a typelist and a template // Invocation (TList is a typelist, Unit is a template of one arg): // GenScatterHierarchy -// The generated class inherits all classes generated by instantiating the -// template 'Unit' with the types contained in TList +// The generated class inherits all classes generated by instantiating the +// template 'Unit' with the types contained in TList //////////////////////////////////////////////////////////////////////////////// - namespace Private - { - // The following type helps to overcome subtle flaw in the original - // implementation of GenScatterHierarchy. - // The flaw is revealed when the input type list of GenScatterHierarchy - // contains more then one element of the same type (e.g. LOKI_TYPELIST_2(int, int)). - // In this case GenScatterHierarchy will contain multiple bases of the same - // type and some of them will not be reachable (per 10.3). - // For example before the fix the first element of Tuple - // is not reachable in any way! - template - struct ScatterHierarchyTag; - } +namespace Private +{ +// The following type helps to overcome subtle flaw in the original +// implementation of GenScatterHierarchy. +// The flaw is revealed when the input type list of GenScatterHierarchy +// contains more then one element of the same type (e.g. LOKI_TYPELIST_2(int, int)). +// In this case GenScatterHierarchy will contain multiple bases of the same +// type and some of them will not be reachable (per 10.3). +// For example before the fix the first element of Tuple +// is not reachable in any way! +template +struct ScatterHierarchyTag; +} - template class Unit> - class GenScatterHierarchy; - - template class Unit> - class GenScatterHierarchy, Unit> - : public GenScatterHierarchy, Unit> - , public GenScatterHierarchy - { - public: - typedef Typelist TList; - // Insure that LeftBase is unique and therefore reachable - typedef GenScatterHierarchy, Unit> LeftBase; - typedef GenScatterHierarchy RightBase; - template struct Rebind - { - typedef Unit Result; - }; - }; - - // In the middle *unique* class that resolve possible ambiguity - template class Unit> - class GenScatterHierarchy, Unit> - : public GenScatterHierarchy +template class Unit> +class GenScatterHierarchy; + +template class Unit> +class GenScatterHierarchy, Unit> + : public GenScatterHierarchy, Unit> + , public GenScatterHierarchy +{ +public: + typedef Typelist TList; + // Insure that LeftBase is unique and therefore reachable + typedef GenScatterHierarchy, Unit> LeftBase; + typedef GenScatterHierarchy RightBase; + template struct Rebind { + typedef Unit Result; }; +}; + +// In the middle *unique* class that resolve possible ambiguity +template class Unit> +class GenScatterHierarchy, Unit> + : public GenScatterHierarchy +{ +}; - template class Unit> - class GenScatterHierarchy : public Unit +template class Unit> +class GenScatterHierarchy : public Unit +{ + typedef Unit LeftBase; + template struct Rebind { - typedef Unit LeftBase; - template struct Rebind - { - typedef Unit Result; - }; + typedef Unit Result; }; - - template