return p1 != p2.get();
}
-namespace webrtc {
-
-// DEPRECATED: Use scoped_ptr<T[]> instead.
-// TODO(ajm): Remove scoped_array.
-//
-// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to
-// is guaranteed, either on destruction of the scoped_array or via an explicit
-// reset(). Use shared_array or std::vector if your needs are more complex.
-
-template<typename T>
-class scoped_array {
- private:
-
- T* ptr;
-
- scoped_array(scoped_array const &);
- scoped_array & operator=(scoped_array const &);
-
- public:
-
- typedef T element_type;
-
- explicit scoped_array(T* p = NULL) : ptr(p) {}
-
- ~scoped_array() {
- typedef char type_must_be_complete[sizeof(T)];
- delete[] ptr;
- }
-
- void reset(T* p = NULL) {
- typedef char type_must_be_complete[sizeof(T)];
-
- if (ptr != p) {
- T* arr = ptr;
- ptr = p;
- // Delete last, in case arr destructor indirectly results in ~scoped_array
- delete [] arr;
- }
- }
-
- T& operator[](ptrdiff_t i) const {
- assert(ptr != NULL);
- assert(i >= 0);
- return ptr[i];
- }
-
- T* get() const {
- return ptr;
- }
-
- void swap(scoped_array & b) {
- T* tmp = b.ptr;
- b.ptr = ptr;
- ptr = tmp;
- }
-
- T* release() {
- T* tmp = ptr;
- ptr = NULL;
- return tmp;
- }
-
- T** accept() {
- if (ptr) {
- delete [] ptr;
- ptr = NULL;
- }
- return &ptr;
- }
-};
-
-template<class T> inline
-void swap(scoped_array<T>& a, scoped_array<T>& b) {
- a.swap(b);
-}
-
-} // namespace webrtc
-
#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SCOPED_PTR_H_