variant_allocator.h
Go to the documentation of this file.
1 
25 #ifndef _VARIANT_ALLOCATOR_H_
26 #define _VARIANT_ALLOCATOR_H_
27 
28 #include <limits>
29 #include "bcap_core/dn_common.h"
30 
31 template<class T> class VariantAllocator
32 {
33 public:
34  typedef size_t size_type;
35  typedef ptrdiff_t difference_type;
36  typedef T* pointer;
37  typedef const T* const_pointer;
38  typedef T& reference;
39  typedef const T& const_reference;
40  typedef T value_type;
41 
42  template <class U>
43  struct rebind
44  {
46  };
47 
48  pointer allocate(size_type num, const void* hint = 0)
49  {
50  return (pointer)( ::operator new(num * sizeof(T)));
51  }
52 
53  void construct(pointer p, const T& value)
54  {
55  VariantInit(p);
56  VariantCopy(p, &value);
57  }
58 
59  pointer address(reference value) const
60  {
61  return &value;
62  }
63 
64  const_pointer address(const_reference value) const
65  {
66  return &value;
67  }
68 
69  void destroy(pointer p)
70  {
71  VariantClear(p);
72  }
73 
74  void deallocate(pointer p, size_type n)
75  {
76  ::operator delete((void*)p);
77  }
78 
79  size_type max_size() const throw()
80  {
81  return std::numeric_limits<size_t>::max() / sizeof(T);
82  }
83 };
84 
85 #endif
void deallocate(pointer p, size_type n)
ptrdiff_t difference_type
void construct(pointer p, const T &value)
void destroy(pointer p)
pointer address(reference value) const
VariantAllocator< U > other
void VariantClear(VARIANT *pvarg)
const T & const_reference
const_pointer address(const_reference value) const
void VariantInit(VARIANT *pvarg)
_DN_EXP_COMMON HRESULT VariantCopy(VARIANT *pvargDest, const VARIANT *pvargSrc)
size_type max_size() const
pointer allocate(size_type num, const void *hint=0)


bcap_service
Author(s): DENSO WAVE INCORPORATED
autogenerated on Mon Jun 10 2019 13:12:23