detail: improve ScopedCancelHandle

This also removes deprecated implicit conversion operators
from 'FooHandle' types to 'const FooId*'

Change-Id: I5b412bf833bb106b8f5aa483dbe09b6c58736e19
diff --git a/tests/unit/detail/cancel-handle.t.cpp b/tests/unit/detail/cancel-handle.t.cpp
index b87f9cd..2e951dd 100644
--- a/tests/unit/detail/cancel-handle.t.cpp
+++ b/tests/unit/detail/cancel-handle.t.cpp
@@ -55,11 +55,13 @@
 
 BOOST_AUTO_TEST_SUITE(ScopedHandle)
 
+using ScopedTestHandle = ScopedCancelHandle<CancelHandle>;
+
 BOOST_AUTO_TEST_CASE(ManualCancel)
 {
   int nCancels = 0;
   {
-    ScopedCancelHandle hdl = makeDummyCancelHandle(nCancels);
+    ScopedTestHandle hdl = makeDummyCancelHandle(nCancels);
     BOOST_CHECK_EQUAL(nCancels, 0);
 
     hdl.cancel();
@@ -72,7 +74,7 @@
 {
   int nCancels = 0;
   {
-    ScopedCancelHandle hdl = makeDummyCancelHandle(nCancels);
+    ScopedTestHandle hdl = makeDummyCancelHandle(nCancels);
     BOOST_CHECK_EQUAL(nCancels, 0);
   } // hdl goes out of scope
   BOOST_CHECK_EQUAL(nCancels, 1);
@@ -82,7 +84,7 @@
 {
   int nCancels1 = 0, nCancels2 = 0;
   {
-    ScopedCancelHandle hdl = makeDummyCancelHandle(nCancels1);
+    ScopedTestHandle hdl = makeDummyCancelHandle(nCancels1);
     hdl = makeDummyCancelHandle(nCancels2);
     BOOST_CHECK_EQUAL(nCancels1, 1);
     BOOST_CHECK_EQUAL(nCancels2, 0);
@@ -94,7 +96,7 @@
 {
   int nCancels = 0;
   {
-    ScopedCancelHandle hdl = makeDummyCancelHandle(nCancels);
+    ScopedTestHandle hdl = makeDummyCancelHandle(nCancels);
     hdl.release();
     hdl.cancel(); // no effect
   } // hdl goes out of scope
@@ -104,10 +106,10 @@
 BOOST_AUTO_TEST_CASE(MoveConstruct)
 {
   int nCancels = 0;
-  unique_ptr<ScopedCancelHandle> hdl1;
+  unique_ptr<ScopedTestHandle> hdl1;
   {
-    ScopedCancelHandle hdl2 = makeDummyCancelHandle(nCancels);
-    hdl1 = make_unique<ScopedCancelHandle>(std::move(hdl2));
+    ScopedTestHandle hdl2 = makeDummyCancelHandle(nCancels);
+    hdl1 = make_unique<ScopedTestHandle>(std::move(hdl2));
   } // hdl2 goes out of scope
   BOOST_CHECK_EQUAL(nCancels, 0);
   hdl1.reset();
@@ -118,9 +120,9 @@
 {
   int nCancels = 0;
   {
-    ScopedCancelHandle hdl1;
+    ScopedTestHandle hdl1;
     {
-      ScopedCancelHandle hdl2 = makeDummyCancelHandle(nCancels);
+      ScopedTestHandle hdl2 = makeDummyCancelHandle(nCancels);
       hdl1 = std::move(hdl2);
     } // hdl2 goes out of scope
     BOOST_CHECK_EQUAL(nCancels, 0);