Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
83a7b79c
Commit
83a7b79c
authored
Apr 27, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a macro to disallow the copy constructor and operator= functions.
parent
5dee2904
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
format-test.cc
format-test.cc
+1
-2
format.h
format.h
+9
-9
No files found.
format-test.cc
View file @
83a7b79c
...
...
@@ -1634,8 +1634,7 @@ TEST(FormatIntTest, FormatDec) {
class
File
{
private:
int
fd_
;
File
(
const
File
&
);
void
operator
=
(
const
File
&
);
FMT_DISALLOW_COPY_AND_ASSIGN
(
File
);
public:
File
(
int
fd
)
:
fd_
(
fd
)
{}
~
File
()
{
close
(
fd_
);
}
...
...
format.h
View file @
83a7b79c
...
...
@@ -99,6 +99,12 @@
# define FMT_NOEXCEPT(expr)
#endif
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#if _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4521) // 'class' : multiple copy constructors specified
...
...
@@ -165,9 +171,7 @@ class Array {
}
}
// Do not implement!
Array
(
const
Array
&
);
void
operator
=
(
const
Array
&
);
FMT_DISALLOW_COPY_AND_ASSIGN
(
Array
);
public:
Array
()
:
size_
(
0
),
capacity_
(
SIZE
),
ptr_
(
data_
)
{}
...
...
@@ -1266,9 +1270,7 @@ class BasicFormatter {
//
// This is done because BasicFormatter objects should normally exist
// only as temporaries returned by one of the formatting functions.
// Do not implement.
BasicFormatter
(
const
BasicFormatter
&
);
BasicFormatter
&
operator
=
(
const
BasicFormatter
&
);
FMT_DISALLOW_COPY_AND_ASSIGN
(
BasicFormatter
);
protected:
const
Char
*
TakeFormatString
()
{
...
...
@@ -1405,9 +1407,7 @@ class Formatter : private Action, public BasicFormatter<Char> {
BasicWriter
<
Char
>
writer_
;
bool
inactive_
;
// Forbid copying other than from a temporary. Do not implement.
Formatter
(
const
Formatter
&
);
Formatter
&
operator
=
(
const
Formatter
&
);
FMT_DISALLOW_COPY_AND_ASSIGN
(
Formatter
);
public:
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment