fix priority queue unit tests
authorkhizmax <khizmax@gmail.com>
Fri, 14 Nov 2014 12:54:44 +0000 (15:54 +0300)
committerkhizmax <khizmax@gmail.com>
Fri, 14 Nov 2014 12:54:44 +0000 (15:54 +0300)
tests/unit/pqueue/ellen_bintree_pqueue.h
tests/unit/pqueue/skiplist_pqueue.h

index 8be18c7ea713cfd1787a84ce67d8c3744f8058de..0eb71a9133eafa4e191cb3e7ff01380881814c18 100644 (file)
@@ -34,11 +34,10 @@ namespace pqueue {
         template <typename T, typename Tree>
         bool operator()( T& dest, Tree& container ) const
         {
-            typename Tree::exempt_ptr ep;
-            bool bRet = container.extract_max( ep );
-            if ( bRet )
+            typename Tree::exempt_ptr ep( container.extract_max());
+            if ( ep )
                 dest = *ep;
-            return bRet;
+            return !ep.empty();
         }
     };
 
@@ -62,11 +61,10 @@ namespace pqueue {
         template <typename T, typename Tree>
         bool operator()( T& dest, Tree& container ) const
         {
-            typename Tree::exempt_ptr ep;
-            bool bRet = container.extract_min( ep );
-            if ( bRet )
+            typename Tree::exempt_ptr ep( container.extract_min());
+            if ( ep )
                 dest = *ep;
-            return bRet;
+            return !ep.empty();
         }
     };
 
index 68a816e9c300c7d2a61d628a4d89fd4439f95efe..92ef9df04d0e92acf49c074d53caf14e087c4fed 100644 (file)
@@ -34,11 +34,10 @@ namespace pqueue {
         template <typename T, typename Set>
         bool operator()( T& dest, Set& container ) const
         {
-            typename Set::exempt_ptr ep;
-            bool bRet = container.extract_max( ep );
-            if ( bRet )
+            typename Set::exempt_ptr ep( container.extract_max());
+            if ( ep )
                 dest = *ep;
-            return bRet;
+            return !ep.empty();
         }
     };
 
@@ -62,11 +61,10 @@ namespace pqueue {
         template <typename T, typename Set>
         bool operator()( T& dest, Set& container ) const
         {
-            typename Set::exempt_ptr ep;
-            bool bRet = container.extract_min( ep );
-            if ( bRet )
+            typename Set::exempt_ptr ep( container.extract_min());
+            if ( ep )
                 dest = *ep;
-            return bRet;
+            return !ep.empty();
         }
     };