blob: db5ef9e696db65f9ac0f54d3f308e2bc7e73145f [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
kwibergba5ea442016-04-25 18:08:40 -070011// This entire file is deprecated, and will be removed in XXXX 2016. Use
12// std::unique_ptr instead!
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000013
14#ifndef WEBRTC_BASE_SCOPED_PTR_H__
15#define WEBRTC_BASE_SCOPED_PTR_H__
16
kwibergba5ea442016-04-25 18:08:40 -070017// All these #includes are left to maximize backwards compatibility.
kwiberg@webrtc.org73ca1942015-01-29 09:12:47 +000018
19#include <assert.h>
20#include <stddef.h>
21#include <stdlib.h>
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000022
kwibergba5ea442016-04-25 18:08:40 -070023#include <algorithm>
kwiberg9390f842015-12-17 06:20:27 -080024#include <cstddef>
kwibergb7f89d62016-02-17 10:04:18 -080025#include <memory>
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000026
kwiberg@webrtc.org73ca1942015-01-29 09:12:47 +000027#include "webrtc/base/constructormagic.h"
kwiberg@webrtc.org73ca1942015-01-29 09:12:47 +000028#include "webrtc/base/template_util.h"
29#include "webrtc/typedefs.h"
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000030
31namespace rtc {
32
kwibergba5ea442016-04-25 18:08:40 -070033template <typename T, typename Deleter = std::default_delete<T>>
34using scoped_ptr = std::unique_ptr<T, Deleter>;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000035
kwibergba5ea442016-04-25 18:08:40 -070036// These used to convert between rtc::scoped_ptr and std::unique_ptr. Now they
37// are no-ops.
kwiberg@webrtc.org73ca1942015-01-29 09:12:47 +000038template <typename T>
kwibergba5ea442016-04-25 18:08:40 -070039std::unique_ptr<T> ScopedToUnique(std::unique_ptr<T> up) {
40 return up;
kwibergb7f89d62016-02-17 10:04:18 -080041}
42template <typename T>
kwibergba5ea442016-04-25 18:08:40 -070043std::unique_ptr<T> UniqueToScoped(std::unique_ptr<T> up) {
44 return up;
kwibergb7f89d62016-02-17 10:04:18 -080045}
46
Karl Wiberg94784372015-04-20 14:03:07 +020047} // namespace rtc
48
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000049#endif // #ifndef WEBRTC_BASE_SCOPED_PTR_H__