diff options
| author | Matt Derksen <v2cibmd@us.ibm.com> | 2016-05-27 16:32:41 -0500 |
|---|---|---|
| committer | Bill Hoffa <wghoffa@us.ibm.com> | 2016-06-02 09:23:52 -0500 |
| commit | 3ddbcbd4b81296fa5524331f5313138d1c45d305 (patch) | |
| tree | c8f3fccea92e4913e2ee68295f9aefe21f63cd52 | |
| parent | 5c59bb5b9c89a173c6771d4db84abb53f4615d93 (diff) | |
| download | blackbird-hostboot-3ddbcbd4b81296fa5524331f5313138d1c45d305.tar.gz blackbird-hostboot-3ddbcbd4b81296fa5524331f5313138d1c45d305.zip | |
Overloaded != operator for shared_ptr.
Also updated cxxtests to make them pass.
Change-Id: I444a9c6c60261755db55fffbed66c92f93965c50
RTC:153697
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/25138
Tested-by: Jenkins Server
Tested-by: FSP CI Jenkins
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: A. P. Williams III <iawillia@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
| -rw-r--r-- | src/include/util/impl/shared_ptr.H | 5 | ||||
| -rw-r--r-- | src/usr/testcore/lib/shared_ptr.H | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/include/util/impl/shared_ptr.H b/src/include/util/impl/shared_ptr.H index 3be41e0ce..08cb6d044 100644 --- a/src/include/util/impl/shared_ptr.H +++ b/src/include/util/impl/shared_ptr.H @@ -83,6 +83,11 @@ namespace std return (pointer == r.pointer); } + bool operator!=(const shared_ptr &r) const + { + return (pointer != r.pointer); + } + shared_ptr& operator=(const shared_ptr& r) { _cleanup(); diff --git a/src/usr/testcore/lib/shared_ptr.H b/src/usr/testcore/lib/shared_ptr.H index 2e68c5774..6a9f4e76a 100644 --- a/src/usr/testcore/lib/shared_ptr.H +++ b/src/usr/testcore/lib/shared_ptr.H @@ -74,12 +74,16 @@ class STLSharedPtrTest : public CxxTest::TestSuite TS_FAIL("p3 is not unique."); } - if (!(p1 == p2)) + if (p1 == p2) { - TS_FAIL("p1 and p2 should be equal"); + TS_FAIL("p1 and p2 should not be equal pointers"); } shared_ptr<T1> p4 = static_pointer_cast<T1>(p3); + if (p3 != p4) + { + TS_FAIL("p3 and p4 should be equal pointers"); + } if (p3.use_count() != 2) { TS_FAIL("p3 is not shared now."); |

