From 25fa0de1c7c2430a0423ec662907c7871ab6aa71 Mon Sep 17 00:00:00 2001 From: khizmax Date: Tue, 23 Sep 2014 17:22:34 +0400 Subject: [PATCH] Remove CDS_CXX11_TEMPLATE_ALIAS_SUPPORT macro and emulating code --- cds/compiler/clang/defs.h | 3 -- cds/compiler/defs.h | 5 +++ cds/compiler/gcc/defs.h | 7 +--- cds/compiler/icl/defs.h | 3 -- cds/compiler/vc/defs.h | 3 -- cds/container/cuckoo_set.h | 6 --- cds/details/binary_functor_wrapper.h | 10 ----- cds/gc/hp_decl.h | 56 ---------------------------- cds/gc/hrc/hrc.h | 6 --- cds/gc/hzp/details/hp_alloc.h | 6 --- cds/gc/ptb_decl.h | 56 ---------------------------- cds/intrusive/basket_queue.h | 10 +---- cds/urcu/details/base.h | 22 ----------- 13 files changed, 7 insertions(+), 186 deletions(-) diff --git a/cds/compiler/clang/defs.h b/cds/compiler/clang/defs.h index 078a0a6a..9ca62d89 100644 --- a/cds/compiler/clang/defs.h +++ b/cds/compiler/clang/defs.h @@ -40,9 +40,6 @@ // Explicit conversion operators #define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT -// C++11 template alias -#define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT - // C++11 inline namespace #define CDS_CXX11_INLINE_NAMESPACE_SUPPORT diff --git a/cds/compiler/defs.h b/cds/compiler/defs.h index 059cc4a1..a373fbcc 100644 --- a/cds/compiler/defs.h +++ b/cds/compiler/defs.h @@ -3,6 +3,11 @@ #ifndef __CDS_ARH_COMPILER_DEFS_H #define __CDS_ARH_COMPILER_DEFS_H +/* + Required C++11 features: + - template alias [CDS_CXX11_TEMPLATE_ALIAS_SUPPORT] +*/ + #if CDS_COMPILER == CDS_COMPILER_MSVC # include #elif CDS_COMPILER == CDS_COMPILER_GCC diff --git a/cds/compiler/gcc/defs.h b/cds/compiler/gcc/defs.h index 471a905d..2bfacc06 100644 --- a/cds/compiler/gcc/defs.h +++ b/cds/compiler/gcc/defs.h @@ -57,16 +57,11 @@ #define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr) #define CDS_CONSTEXPR_CONST constexpr const -// C++11 template alias -#define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT - // C++11 thread_local keyword #define CDS_CXX11_THREAD_LOCAL_SUPPORT // Full SFINAE support -#if CDS_COMPILER_VERSION >= 40700 -# define CDS_CXX11_SFINAE -#endif +#define CDS_CXX11_SFINAE // ************************************************* // Alignment macro diff --git a/cds/compiler/icl/defs.h b/cds/compiler/icl/defs.h index 195b69a0..1037ba07 100644 --- a/cds/compiler/icl/defs.h +++ b/cds/compiler/icl/defs.h @@ -103,9 +103,6 @@ // Variadic template support (ICL 12.1+) #define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT 1 -// C++11 template alias -#define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT - // C++11 inline namespace #define CDS_CXX11_INLINE_NAMESPACE_SUPPORT diff --git a/cds/compiler/vc/defs.h b/cds/compiler/vc/defs.h index 8e20209d..59a33d03 100644 --- a/cds/compiler/vc/defs.h +++ b/cds/compiler/vc/defs.h @@ -106,9 +106,6 @@ // Variadic template support (VC12+) #define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT 1 -// C++11 template alias -#define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT - // C++11 inline namespace //#define CDS_CXX11_INLINE_NAMESPACE_SUPPORT diff --git a/cds/container/cuckoo_set.h b/cds/container/cuckoo_set.h index 14f77297..c1ffe3d9 100644 --- a/cds/container/cuckoo_set.h +++ b/cds/container/cuckoo_set.h @@ -46,14 +46,8 @@ namespace cds { namespace container { } }; -#ifdef CDS_CXX11_TEMPLATE_ALIAS_SUPPORT template using predicate_wrapper = cds::details::binary_functor_wrapper< ReturnValue, Pred, node_type, value_accessor >; -#else - template - struct predicate_wrapper: public cds::details::binary_functor_wrapper< ReturnValue, Pred, node_type, value_accessor > - {}; -#endif struct intrusive_traits: public original_type_traits { diff --git a/cds/details/binary_functor_wrapper.h b/cds/details/binary_functor_wrapper.h index 1acbb2a5..f82b887c 100644 --- a/cds/details/binary_functor_wrapper.h +++ b/cds/details/binary_functor_wrapper.h @@ -39,21 +39,11 @@ namespace cds { namespace details { } }; -#ifdef CDS_CXX11_TEMPLATE_ALIAS_SUPPORT template using predicate_wrapper = binary_functor_wrapper< bool, Predicate, ArgType, Accessor>; template using compare_wrapper = binary_functor_wrapper< int, Compare, ArgType, Accessor>; -#else - template - struct predicate_wrapper: public binary_functor_wrapper< bool, Predicate, ArgType, Accessor> - {}; - - template - struct compare_wrapper: public binary_functor_wrapper< int, Compare, ArgType, Accessor > - {}; -#endif }} // namespace cds::details diff --git a/cds/gc/hp_decl.h b/cds/gc/hp_decl.h index d2c98b74..3b274db6 100644 --- a/cds/gc/hp_decl.h +++ b/cds/gc/hp_decl.h @@ -28,7 +28,6 @@ namespace cds { namespace gc { /// Native guarded pointer type typedef gc::hzp::hazard_pointer guarded_pointer; -#ifdef CDS_CXX11_TEMPLATE_ALIAS_SUPPORT /// Atomic reference /** @headerfile cds/gc/hp.h @@ -46,61 +45,6 @@ namespace cds { namespace gc { @headerfile cds/gc/hp.h */ template using atomic_type = atomics::atomic; -#else - template - class atomic_ref: public atomics::atomic - { - typedef atomics::atomic base_class; - public: -# ifdef CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT - atomic_ref() = default; -# else - atomic_ref() - : base_class() - {} -# endif - explicit CDS_CONSTEXPR atomic_ref(T * p) CDS_NOEXCEPT - : base_class( p ) - {} - }; - - template - class atomic_type: public atomics::atomic - { - typedef atomics::atomic base_class; - public: -# ifdef CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT - atomic_type() = default; -# else - atomic_type() CDS_NOEXCEPT - : base_class() - {} -# endif - explicit CDS_CONSTEXPR atomic_type(T const & v) CDS_NOEXCEPT - : base_class( v ) - {} - }; - - template - class atomic_marked_ptr: public atomics::atomic - { - typedef atomics::atomic base_class; - public: -# ifdef CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT - atomic_marked_ptr() CDS_NOEXCEPT_DEFAULTED_( noexcept(base_class()) ) = default; -# else - atomic_marked_ptr() CDS_NOEXCEPT_( noexcept(base_class()) ) - : base_class() - {} -# endif - explicit CDS_CONSTEXPR atomic_marked_ptr(MarkedPtr val) CDS_NOEXCEPT_( noexcept(base_class( val )) ) - : base_class( val ) - {} - explicit CDS_CONSTEXPR atomic_marked_ptr(typename MarkedPtr::value_type * p) CDS_NOEXCEPT_( noexcept(base_class( p )) ) - : base_class( p ) - {} - }; -#endif /// Thread GC implementation for internal usage typedef hzp::ThreadGC thread_gc_impl; diff --git a/cds/gc/hrc/hrc.h b/cds/gc/hrc/hrc.h index a5e45e51..96cb1606 100644 --- a/cds/gc/hrc/hrc.h +++ b/cds/gc/hrc/hrc.h @@ -184,13 +184,7 @@ namespace cds { namespace gc { /** This is wrapper for cds::gc::hzp::details::HPArray class */ -#ifdef CDS_CXX11_TEMPLATE_ALIAS_SUPPORT template using HPArray = gc::hzp::details::HPArrayT; -#else - template - class HPArray: public gc::hzp::details::HPArrayT - {}; -#endif /// HP record of the thread /** diff --git a/cds/gc/hzp/details/hp_alloc.h b/cds/gc/hzp/details/hp_alloc.h index ad69e3cf..83a8772f 100644 --- a/cds/gc/hzp/details/hp_alloc.h +++ b/cds/gc/hzp/details/hp_alloc.h @@ -176,13 +176,7 @@ namespace cds { }; /// Specialization of HPArrayT class for hazard_pointer type -#ifdef CDS_CXX11_TEMPLATE_ALIAS_SUPPORT template using HPArray = HPArrayT; -#else - template - class HPArray: public HPArrayT - {}; -#endif /// Allocator of hazard pointers for the thread /** diff --git a/cds/gc/ptb_decl.h b/cds/gc/ptb_decl.h index eae4dcf8..1c3b8305 100644 --- a/cds/gc/ptb_decl.h +++ b/cds/gc/ptb_decl.h @@ -30,7 +30,6 @@ namespace cds { namespace gc { /// Native guarded pointer type typedef void * guarded_pointer; -#ifdef CDS_CXX11_TEMPLATE_ALIAS_SUPPORT /// Atomic reference /** @headerfile cds/gc/ptb.h @@ -48,61 +47,6 @@ namespace cds { namespace gc { @headerfile cds/gc/ptb.h */ template using atomic_marked_ptr = atomics::atomic; -#else - template - class atomic_ref: public atomics::atomic - { - typedef atomics::atomic base_class; - public: -# ifdef CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT - atomic_ref() = default; -# else - atomic_ref() - : base_class() - {} -# endif - explicit CDS_CONSTEXPR atomic_ref(T * p) CDS_NOEXCEPT - : base_class( p ) - {} - }; - - template - class atomic_type: public atomics::atomic - { - typedef atomics::atomic base_class; - public: -# ifdef CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT - atomic_type() = default; -# else - atomic_type() CDS_NOEXCEPT - : base_class() - {} -# endif - explicit CDS_CONSTEXPR atomic_type(T const & v) CDS_NOEXCEPT - : base_class( v ) - {} - }; - - template - class atomic_marked_ptr: public atomics::atomic - { - typedef atomics::atomic base_class; - public: -# ifdef CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT - atomic_marked_ptr() = default; -# else - atomic_marked_ptr() - : base_class() - {} -# endif - explicit CDS_CONSTEXPR atomic_marked_ptr(MarkedPtr val) CDS_NOEXCEPT - : base_class( val ) - {} - explicit CDS_CONSTEXPR atomic_marked_ptr(typename MarkedPtr::value_type * p) CDS_NOEXCEPT - : base_class( p ) - {} - }; -#endif /// Thread GC implementation for internal usage typedef ptb::ThreadGC thread_gc_impl; diff --git a/cds/intrusive/basket_queue.h b/cds/intrusive/basket_queue.h index 4e52726c..5b214da5 100644 --- a/cds/intrusive/basket_queue.h +++ b/cds/intrusive/basket_queue.h @@ -153,16 +153,8 @@ namespace cds { namespace intrusive { //@endcond }; - -#if defined(CDS_CXX11_TEMPLATE_ALIAS_SUPPORT) && !defined(CDS_DOXYGEN_INVOKED) - template < typename Node, opt::link_check_type LinkType > using get_link_checker = single_link::get_link_checker< Node, LinkType >; -#else /// Metafunction for selecting appropriate link checking policy - template < typename Node, opt::link_check_type LinkType > - struct get_link_checker: public single_link::get_link_checker< Node, LinkType > - {}; - -#endif + template < typename Node, opt::link_check_type LinkType > using get_link_checker = single_link::get_link_checker< Node, LinkType >; /// Basket queue internal statistics. May be used for debugging or profiling /** diff --git a/cds/urcu/details/base.h b/cds/urcu/details/base.h index 5443acb0..e45a862a 100644 --- a/cds/urcu/details/base.h +++ b/cds/urcu/details/base.h @@ -286,29 +286,7 @@ namespace cds { class gc_common { public: -# ifdef CDS_CXX11_TEMPLATE_ALIAS_SUPPORT template using atomic_marked_ptr = atomics::atomic; -# else - template - class atomic_marked_ptr: public atomics::atomic - { - typedef atomics::atomic base_class; - public: -# ifdef CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT - atomic_marked_ptr() CDS_NOEXCEPT_DEFAULTED_( noexcept(base_class()) ) = default; -# else - atomic_marked_ptr() CDS_NOEXCEPT_( noexcept(base_class()) ) - : base_class() - {} -# endif - explicit CDS_CONSTEXPR atomic_marked_ptr(MarkedPtr val) CDS_NOEXCEPT_( noexcept(base_class( val )) ) - : base_class( val ) - {} - explicit CDS_CONSTEXPR atomic_marked_ptr(typename MarkedPtr::value_type * p) CDS_NOEXCEPT_( noexcept(base_class( p )) ) - : base_class( p ) - {} - }; -# endif }; //@endcond -- 2.34.1