diff liboctave/util/oct-refcount.h @ 23012:27e4ec3b0b49

move octave_refcount inside octave namespace * oct-refcount.h (refcount): Move inside octave namespace and rename from octave_refcount. Change all uses. (octave_refcount): Provide (deprecated) backward-compatible using declaration.
author John W. Eaton <jwe@octave.org>
date Fri, 06 Jan 2017 18:06:31 -0500
parents 3a2b891d0b33
children ef4d915df748
line wrap: on
line diff
--- a/liboctave/util/oct-refcount.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/util/oct-refcount.h	Fri Jan 06 18:06:31 2017 -0500
@@ -66,53 +66,60 @@
 
 #endif
 
-// Encapsulates a reference counter.
-template <typename T>
-class octave_refcount
+namespace octave
 {
-public:
+
+  // Encapsulates a reference counter.
 
-  typedef T count_type;
+  template <typename T>
+  class refcount
+  {
+  public:
+
+    typedef T count_type;
 
-  octave_refcount (count_type initial_count)
-    : count (initial_count)
-  { }
+    refcount (count_type initial_count)
+      : count (initial_count)
+    { }
 
-  // Increment/Decrement.  int is postfix.
-  count_type operator++ (void)
-  {
-    return OCTAVE_ATOMIC_INCREMENT (&count);
-  }
+    // Increment/Decrement.  int is postfix.
+    count_type operator++ (void)
+    {
+      return OCTAVE_ATOMIC_INCREMENT (&count);
+    }
 
-  count_type operator++ (int)
-  {
-    return OCTAVE_ATOMIC_POST_INCREMENT (&count);
-  }
+    count_type operator++ (int)
+    {
+      return OCTAVE_ATOMIC_POST_INCREMENT (&count);
+    }
 
-  count_type operator-- (void)
-  {
-    return OCTAVE_ATOMIC_DECREMENT (&count);
-  }
+    count_type operator-- (void)
+    {
+      return OCTAVE_ATOMIC_DECREMENT (&count);
+    }
 
-  count_type operator-- (int)
-  {
-    return OCTAVE_ATOMIC_POST_DECREMENT (&count);
-  }
+    count_type operator-- (int)
+    {
+      return OCTAVE_ATOMIC_POST_DECREMENT (&count);
+    }
 
-  operator count_type (void) const
-  {
-    return static_cast<count_type const volatile&> (count);
-  }
+    operator count_type (void) const
+    {
+      return static_cast<count_type const volatile&> (count);
+    }
 
-  count_type *get (void)
-  {
-    return &count;
-  }
+    count_type *get (void)
+    {
+      return &count;
+    }
+
+  private:
 
-private:
+    count_type count;
+  };
+}
 
-  count_type count;
-};
+template <typename T>
+using octave_refcount OCTAVE_DEPRECATED (("use 'octave::refcount' instead")) = octave::refcount<T>;
 
 #endif
-