libzypp  17.35.11
Easy.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_BASE_EASY_H
13 #define ZYPP_BASE_EASY_H
14 
15 #include <cstdio>
16 #include <zypp/base/TypeTraits.h>
17 
27 #ifndef __GXX_EXPERIMENTAL_CXX0X__
28 #define for_(IT,BEG,END) for ( __typeof__(BEG) IT = BEG, _for_end = END; IT != _for_end; ++IT )
29 #else
30 #define for_(IT,BEG,END) for ( auto IT = BEG, _for_end = END; IT != _for_end; ++IT )
31 #endif
32 #define for_each_(IT,CONT) for_( IT, (CONT).begin(), (CONT).end() )
33 
41 #define arrayBegin(A) (&A[0])
42 #define arraySize(A) (sizeof(A)/sizeof(*A))
43 #define arrayEnd(A) (&A[0] + arraySize(A))
44 
51 #define defConstStr(FNC,STR) inline const std::string & FNC { static const std::string val( STR ); return val; }
52 
54 #define NON_COPYABLE(CLASS) \
55  CLASS( const CLASS & ) = delete; \
56  CLASS & operator=( const CLASS & ) = delete
57 
59 #define DEFAULT_COPYABLE(CLASS) \
60  CLASS( const CLASS & ) = default; \
61  CLASS & operator=( const CLASS & ) = default
62 
64 #define NON_MOVABLE(CLASS) \
65  CLASS( CLASS && ) = delete; \
66  CLASS & operator=( CLASS && ) = delete
67 
69 #define DEFAULT_MOVABLE(CLASS) \
70  CLASS( CLASS && ) = default; \
71  CLASS & operator=( CLASS && ) = default
72 
74 #define NON_COPYABLE_BUT_MOVE( CLASS ) \
75  NON_COPYABLE(CLASS); \
76  DEFAULT_MOVABLE(CLASS)
77 
79 #define NON_MOVABLE_BUT_COPY( CLASS ) \
80  NON_MOVABLE(CLASS); \
81  DEFAULT_COPYABLE(CLASS)
82 
83 
102 template<typename TBase, typename TDerived>
104 
106 namespace zypp
107 {
108 } // namespace zypp
111 #endif // ZYPP_BASE_EASY_H
std::enable_if_t<!std::is_base_of_v< TBase, std::remove_reference_t< TDerived > >> disable_use_as_copy_ctor
Prevent an universal ctor to be chosen as copy ctor.
Definition: Easy.h:103
typename enable_if< B, T >::type enable_if_t
Definition: TypeTraits.h:45
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19