Skip to content

Commit 1090d1a

Browse files
committed
Use = default/delete for trivial C++ class constructors
This is applying clang-tidy's `modernize-use-equals-default` and `modernize-use-equals-delete` checks.
1 parent 8e01289 commit 1090d1a

File tree

5 files changed

+12
-22
lines changed

5 files changed

+12
-22
lines changed

src/_backend_agg.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ class BufferRegion
6565
delete[] data;
6666
};
6767

68+
// prevent copying
69+
BufferRegion(const BufferRegion &) = delete;
70+
BufferRegion &operator=(const BufferRegion &) = delete;
71+
6872
agg::int8u *get_data()
6973
{
7074
return data;
@@ -96,11 +100,6 @@ class BufferRegion
96100
int width;
97101
int height;
98102
int stride;
99-
100-
private:
101-
// prevent copying
102-
BufferRegion(const BufferRegion &);
103-
BufferRegion &operator=(const BufferRegion &);
104103
};
105104

106105
#define MARKER_CACHE_SIZE 512

src/_image_resample.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,16 @@ namespace agg
6060
value_type a;
6161

6262
//--------------------------------------------------------------------
63-
gray64() {}
63+
gray64() = default;
6464

6565
//--------------------------------------------------------------------
66-
explicit gray64(value_type v_, value_type a_ = 1) :
67-
v(v_), a(a_) {}
66+
explicit gray64(value_type v_, value_type a_ = 1) : v(v_), a(a_) {}
6867

6968
//--------------------------------------------------------------------
70-
gray64(const self_type& c, value_type a_) :
71-
v(c.v), a(a_) {}
69+
gray64(const self_type& c, value_type a_) : v(c.v), a(a_) {}
7270

7371
//--------------------------------------------------------------------
74-
gray64(const gray64& c) :
75-
v(c.v),
76-
a(c.a) {}
72+
gray64(const gray64& c) = default;
7773

7874
//--------------------------------------------------------------------
7975
static AGG_INLINE double to_double(value_type a)
@@ -246,7 +242,7 @@ namespace agg
246242
value_type a;
247243

248244
//--------------------------------------------------------------------
249-
rgba64() {}
245+
rgba64() = default;
250246

251247
//--------------------------------------------------------------------
252248
rgba64(value_type r_, value_type g_, value_type b_, value_type a_= 1) :

src/array.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ class empty
5656
public:
5757
typedef empty<T> sub_t;
5858

59-
empty()
60-
{
61-
}
59+
empty() = default;
6260

6361
T &operator()(int i, int j = 0, int k = 0)
6462
{

src/path_converters.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ class EmbeddedQueue
5959

6060
struct item
6161
{
62-
item()
63-
{
64-
}
62+
item() = default;
6563

6664
inline void set(const unsigned cmd_, const double x_, const double y_)
6765
{

src/tri/_tri.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ std::ostream& operator<<(std::ostream& os, const TriEdge& tri_edge)
4444

4545

4646

47-
XY::XY()
48-
{}
47+
XY::XY() = default;
4948

5049
XY::XY(const double& x_, const double& y_)
5150
: x(x_), y(y_)

0 commit comments

Comments
 (0)