Skip to content
Snippets Groups Projects
Commit ab5a73f2 authored by Oliver Sander's avatar Oliver Sander
Browse files

rename the method count() to use_count(). This is the naming of the standard...

rename the method count() to use_count().  This is the naming of the standard shared-pointer implementation

[[Imported from SVN: r5641]]
parent 318946c6
No related branches found
No related tags found
No related merge requests found
...@@ -79,7 +79,10 @@ namespace Dune ...@@ -79,7 +79,10 @@ namespace Dune
* pointers reference it. * pointers reference it.
*/ */
inline void deallocate(); inline void deallocate();
int count() const;
/** \brief The number of shared_ptrs pointing to the object we point to */
int use_count() const;
private: private:
/** @brief The object we reference. */ /** @brief The object we reference. */
class PointerRep class PointerRep
......
...@@ -19,7 +19,7 @@ int main(){ ...@@ -19,7 +19,7 @@ int main(){
shared_ptr<double> d(b); shared_ptr<double> d(b);
*b = 7; *b = 7;
} }
if(b.count()!=1) { if(b.use_count()!=1) {
std::cout << "Reference count is wrong! "<<__LINE__<<":"<< std::cout << "Reference count is wrong! "<<__LINE__<<":"<<
__FILE__<<std::endl; __FILE__<<std::endl;
ret=1; ret=1;
...@@ -32,7 +32,7 @@ int main(){ ...@@ -32,7 +32,7 @@ int main(){
__FILE__<<std::endl; __FILE__<<std::endl;
ret=1; ret=1;
} }
if(b.count()!=2 || c.count()!=2) { if(b.use_count()!=2 || c.use_count()!=2) {
std::cout << "Reference count is wrong! "<<__LINE__<<":"<< std::cout << "Reference count is wrong! "<<__LINE__<<":"<<
__FILE__<<std::endl; __FILE__<<std::endl;
ret=1; ret=1;
...@@ -45,7 +45,7 @@ int main(){ ...@@ -45,7 +45,7 @@ int main(){
} }
} }
if(b.count()!=1) { if(b.use_count()!=1) {
std::cout << "Reference count is wrong! "<<__LINE__<<":"<< std::cout << "Reference count is wrong! "<<__LINE__<<":"<<
__FILE__<<std::endl; __FILE__<<std::endl;
ret=1; ret=1;
......
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