summaryrefslogtreecommitdiff
path: root/src/dpl/core/include/cchecker/dpl/scoped_array.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dpl/core/include/cchecker/dpl/scoped_array.h')
-rw-r--r--src/dpl/core/include/cchecker/dpl/scoped_array.h51
1 files changed, 24 insertions, 27 deletions
diff --git a/src/dpl/core/include/cchecker/dpl/scoped_array.h b/src/dpl/core/include/cchecker/dpl/scoped_array.h
index 54c0c80..f38ae83 100644
--- a/src/dpl/core/include/cchecker/dpl/scoped_array.h
+++ b/src/dpl/core/include/cchecker/dpl/scoped_array.h
@@ -29,36 +29,33 @@
namespace CCHECKER {
template<typename Class>
-struct ScopedArrayPolicy
-{
- typedef Class* Type;
- static Type NullValue()
- {
- return NULL;
- }
- static void Destroy(Type ptr)
- {
- delete[] ptr;
- }
+struct ScopedArrayPolicy {
+ typedef Class *Type;
+ static Type NullValue()
+ {
+ return NULL;
+ }
+ static void Destroy(Type ptr)
+ {
+ delete[] ptr;
+ }
};
template<typename Class>
-class ScopedArray : public ScopedResource<ScopedArrayPolicy<Class> >
-{
- typedef ScopedArrayPolicy<Class> Policy;
- typedef ScopedResource<Policy> BaseType;
-
- public:
- explicit ScopedArray(Class *ptr = Policy::NullValue()) : BaseType(ptr) { }
-
- Class &operator [](std::ptrdiff_t k) const
- {
- Assert(this->m_value != Policy::NullValue() &&
- "Dereference of scoped NULL array!");
- Assert(k >= 0 && "Negative array index");
-
- return this->m_value[k];
- }
+class ScopedArray : public ScopedResource<ScopedArrayPolicy<Class>> {
+ typedef ScopedArrayPolicy<Class> Policy;
+ typedef ScopedResource<Policy> BaseType;
+
+public:
+ explicit ScopedArray(Class *ptr = Policy::NullValue()) : BaseType(ptr) { }
+
+ Class &operator[](std::ptrdiff_t k) const
+ {
+ Assert(this->m_value != Policy::NullValue() &&
+ "Dereference of scoped NULL array!");
+ Assert(k >= 0 && "Negative array index");
+ return this->m_value[k];
+ }
};
} // namespace CCHECKER