Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

RefCountedBool.hh

Go to the documentation of this file.
00001 #ifndef NOPTR_REF_COUNTED_POD_H
00002 #define NOPTR_REF_COUNTED_POD_H
00003 
00023 #include <stddef.h>
00024 
00025 namespace NoPtr
00026 {
00027     
00028 namespace NoPtrImpl
00029 {
00030     
00031     // Structure that aggregates the reference count and boolean
00032     template <typename StoreT = size_t>
00033     struct RefCountedBool
00034     {
00036         static const unsigned short bitsPerByte = 8;
00038         static const unsigned short countBits 
00039             = bitsPerByte*sizeof(StoreT) - 1;
00040 
00041         StoreT count: countBits; 
00042         StoreT valid: 1;         
00043 
00045         RefCountedBool(bool init = false): count(1), valid(init) {}
00047         bool operator==(const RefCountedBool& rhs) const 
00048         {
00049             return count == rhs.count && valid == rhs.valid;
00050         }
00051     };
00052     
00053 } // NoPtrImpl namespace
00054 
00055 } // NoPtr namespace
00056         
00057 #endif // NOPTR_REF_COUNTED_POD_H

Generated on Mon Aug 4 18:51:23 2003 for NoPtr C++ Library by doxygen 1.3.2