Commit fc4fccd6 authored by dcheng@chromium.org's avatar dcheng@chromium.org

Make scoped_array<T> more compatible with scoped_ptr<T[]>.

The eventual plan is to replace scoped_array<T> with scoped_ptr<T[]>.
All existing issues with these new restrictions have been fixed, so I'd
like to enforce them for scoped_array while the transition is still in
progress.

BUG=171118

Review URL: https://codereview.chromium.org/13673002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192528 0039d316-1c4b-4281-b951-d872f2087c98
parent e33c1cb6
......@@ -663,6 +663,18 @@ class scoped_array {
private:
C* array_;
// Disable initialization from any type other than C*, by providing a
// constructor that matches such an initialization, but is private and has no
// definition. This is disabled because it is not safe to call delete[] on an
// array whose static type does not match its dynamic type.
template <typename C2> explicit scoped_array(C2* array);
explicit scoped_array(int disallow_construction_from_null);
// Disable reset() from any type other than C*, for the same reasons as the
// constructor above.
template <typename C2> void reset(C2* array);
void reset(int disallow_reset_from_null);
// Forbid comparison of different scoped_array types.
template <class C2> bool operator==(scoped_array<C2> const& p2) const;
template <class C2> bool operator!=(scoped_array<C2> const& p2) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment