Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
0ea32d79
Commit
0ea32d79
authored
Aug 02, 2012
by
Mukund Sivaraman
Browse files
[2105] Make setData() optionally return the old data
parent
65976ab2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/datasrc/memory/domaintree.h
View file @
0ea32d79
...
...
@@ -244,12 +244,21 @@ public:
/// \name Setter functions.
//@{
/// \brief Set the data stored in the node. If there is old data, it
/// is destroyed.
void
setData
(
T
*
data
)
{
const
DT
deleter
;
deleter
(
data_
);
/// \brief Set the data stored in the node. If there is old data, it
/// is either returned or destroyed based on what is passed in \c
/// old_data.
/// \param data The new data to set.
/// \param old_data If \c NULL is passed here, any old data is
/// destroyed. Otherwise, the old data is returned
/// in this location.
void
setData
(
T
*
data
,
T
**
old_data
=
NULL
)
{
if
(
old_data
!=
NULL
)
{
*
old_data
=
data
;
}
else
{
const
DT
deleter
;
deleter
(
data_
);
}
data_
=
data
;
}
//@}
...
...
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