Skip to content
Snippets Groups Projects
Commit 70c93528 authored by Christian Engwer's avatar Christian Engwer
Browse files

[shared_ptr]

test initialization from nullptr
fix bool cast of Dune implementation

[[Imported from SVN: r7040]]
parent d16b2c64
No related branches found
No related tags found
No related merge requests found
......@@ -112,6 +112,11 @@ namespace Dune
return rep_==0 ? 0 : rep_->rep_;
}
/** \brief Checks if shared_ptr manages an object, i.e. whether get() != 0. */
explicit operator bool() const {
return rep_ != 0 && rep_->rep_ != 0;
}
/** \brief Swap content of this shared_ptr and another */
inline void swap(shared_ptr& other);
......
......@@ -128,6 +128,11 @@ int main(){
shared_ptr<double> bar(new double(43.0));
assert(bar);
// test constructor from nullptr
shared_ptr<double> bar_null(nullptr);
assert(!bar_null);
assert(!bar_null.get());
// test reset()
bar.reset();
assert(!bar);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment