libzypp
17.37.17
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
#define for_(IT,BEG,END) for ( auto IT = BEG, _for_end = END; IT != _for_end; ++IT )
28
36
#define arrayBegin(A) (&A[0])
37
#define arraySize(A) (sizeof(A)/sizeof(*A))
38
#define arrayEnd(A) (&A[0] + arraySize(A))
39
46
#define defConstStr(FNC,STR) inline const std::string & FNC { static const std::string val( STR ); return val; }
47
49
#define NON_COPYABLE(CLASS) \
50
CLASS( const CLASS & ) = delete; \
51
CLASS & operator=( const CLASS & ) = delete
52
54
#define DEFAULT_COPYABLE(CLASS) \
55
CLASS( const CLASS & ) = default; \
56
CLASS & operator=( const CLASS & ) = default
57
59
#define NON_MOVABLE(CLASS) \
60
CLASS( CLASS && ) = delete; \
61
CLASS & operator=( CLASS && ) = delete
62
64
#define DEFAULT_MOVABLE(CLASS) \
65
CLASS( CLASS && ) = default; \
66
CLASS & operator=( CLASS && ) = default
67
69
#define NON_COPYABLE_BUT_MOVE( CLASS ) \
70
NON_COPYABLE(CLASS); \
71
DEFAULT_MOVABLE(CLASS)
72
74
#define NON_MOVABLE_BUT_COPY( CLASS ) \
75
NON_MOVABLE(CLASS); \
76
DEFAULT_COPYABLE(CLASS)
77
78
97
template
<
typename
TBase,
typename
TDerived>
98
using
disable_use_as_copy_ctor
=
std::enable_if_t<!std::is_base_of_v<TBase,std::remove_reference_t<TDerived>
>>;
99
101
namespace
zypp
102
{
104
}
// namespace zypp
106
#endif
// ZYPP_BASE_EASY_H
TypeTraits.h
std::enable_if_t
typename enable_if< B, T >::type enable_if_t
Definition
TypeTraits.h:45
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition
CodePitfalls.doc:2
disable_use_as_copy_ctor
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:98
zypp-core
base
Easy.h
Generated by
1.14.0