Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
0ded2359
Commit
0ded2359
authored
Jan 14, 2021
by
Max Kellermann
Committed by
Max Kellermann
Jan 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/AllocatedString: add operator=()
parent
c1a7aa65
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
AllocatedString.hxx
src/util/AllocatedString.hxx
+14
-0
No files found.
src/util/AllocatedString.hxx
View file @
0ded2359
...
@@ -100,6 +100,18 @@ public:
...
@@ -100,6 +100,18 @@ public:
return
*
this
;
return
*
this
;
}
}
BasicAllocatedString
&
operator
=
(
std
::
string_view
src
)
noexcept
{
delete
[]
std
::
exchange
(
value
,
nullptr
);
value
=
Duplicate
(
src
);
return
*
this
;
}
BasicAllocatedString
&
operator
=
(
const
char
*
src
)
noexcept
{
delete
[]
std
::
exchange
(
value
,
nullptr
);
value
=
src
!=
nullptr
?
Duplicate
(
src
)
:
nullptr
;
return
*
this
;
}
constexpr
bool
operator
==
(
std
::
nullptr_t
)
const
noexcept
{
constexpr
bool
operator
==
(
std
::
nullptr_t
)
const
noexcept
{
return
value
==
nullptr
;
return
value
==
nullptr
;
}
}
...
@@ -161,6 +173,8 @@ public:
...
@@ -161,6 +173,8 @@ public:
AllocatedString
()
noexcept
=
default
;
AllocatedString
()
noexcept
=
default
;
AllocatedString
(
BasicAllocatedString
<
value_type
>
&&
src
)
noexcept
AllocatedString
(
BasicAllocatedString
<
value_type
>
&&
src
)
noexcept
:
BasicAllocatedString
(
std
::
move
(
src
))
{}
:
BasicAllocatedString
(
std
::
move
(
src
))
{}
using
BasicAllocatedString
::
operator
=
;
};
};
#endif
#endif
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