12 #ifndef ZYPP_BASE_EASY_H 13 #define ZYPP_BASE_EASY_H 16 #include <type_traits> 27 #ifndef __GXX_EXPERIMENTAL_CXX0X__ 28 #define for_(IT,BEG,END) for ( __typeof__(BEG) IT = BEG, _for_end = END; IT != _for_end; ++IT ) 30 #define for_(IT,BEG,END) for ( auto IT = BEG, _for_end = END; IT != _for_end; ++IT ) 32 #define for_each_(IT,CONT) for_( IT, (CONT).begin(), (CONT).end() ) 41 #define arrayBegin(A) (&A[0]) 42 #define arraySize(A) (sizeof(A)/sizeof(*A)) 43 #define arrayEnd(A) (&A[0] + arraySize(A)) 51 #define defConstStr(FNC,STR) inline const std::string & FNC { static const std::string val( STR ); return val; } 53 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 54 #if GCC_VERSION < 40600 || not defined(__GXX_EXPERIMENTAL_CXX0X__) 59 #define NON_COPYABLE(CLASS) \ 60 CLASS( const CLASS & ) = delete; \ 61 CLASS & operator=( const CLASS & ) = delete 64 #define DEFAULT_COPYABLE(CLASS) \ 65 CLASS( const CLASS & ) = default; \ 66 CLASS & operator=( const CLASS & ) = default 68 #ifndef SWIG // Swig treats it as syntax error 70 #define NON_MOVABLE(CLASS) \ 71 CLASS( CLASS && ) = delete; \ 72 CLASS & operator=( CLASS && ) = delete 75 #define DEFAULT_MOVABLE(CLASS) \ 76 CLASS( CLASS && ) = default; \ 77 CLASS & operator=( CLASS && ) = default 79 #define NON_MOVABLE(CLASS) 80 #define DEFAULT_MOVABLE(CLASS) 84 #define NON_COPYABLE_BUT_MOVE( CLASS ) \ 85 NON_COPYABLE(CLASS); \ 86 DEFAULT_MOVABLE(CLASS) 89 #define NON_MOVABLE_BUT_COPY( CLASS ) \ 91 DEFAULT_COPYABLE(CLASS) 112 template<
typename TBase,
typename TDerived>
113 using disable_use_as_copy_ctor =
typename std::enable_if<!std::is_base_of<TBase,typename std::remove_reference<TDerived>::type>::value>::type;
121 #endif // ZYPP_BASE_EASY_H typename std::enable_if<!std::is_base_of< TBase, typename std::remove_reference< TDerived >::type >::value >::type disable_use_as_copy_ctor
Prevent an universal ctor to be chosen as copy ctor.
Easy-to use interface to the ZYPP dependency resolver.