paludis Version 3.0.2
The one true package mangler
remove_shared_ptr.hh
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
5 *
6 * This file is part of the Paludis package manager. Paludis is free software;
7 * you can redistribute it and/or modify it under the terms of the GNU General
8 * Public License version 2, as published by the Free Software Foundation.
9 *
10 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef PALUDIS_GUARD_PALUDIS_UTIL_REMOVE_SHARED_PTR_HH
21#define PALUDIS_GUARD_PALUDIS_UTIL_REMOVE_SHARED_PTR_HH 1
22
23#include <memory>
24
25namespace paludis
26{
27 /**
28 * Like std::remove_pointer for std::shared_ptr.
29 *
30 * \ingroup g_utils
31 */
32 template <typename T_>
34 {
35 /// T_ with the std::shared_ptr removed.
36 typedef T_ Type;
37 };
38
39 /**
40 * Like std::remove_pointer for std::shared_ptr.
41 *
42 * \ingroup g_utils
43 */
44 template <typename T_>
45 struct RemoveSharedPtr<std::shared_ptr<T_> >
46 {
47 /// T_ with the std::shared_ptr removed.
48 typedef T_ Type;
49 };
50
51 /**
52 * Like std::remove_pointer for std::shared_ptr.
53 *
54 * \ingroup g_utils
55 */
56 template <typename T_>
57 struct RemoveSharedPtr<std::shared_ptr<const T_> >
58 {
59 /// T_ with the std::shared_ptr removed.
60 typedef const T_ Type;
61 };
62
63 /**
64 * Like std::remove_pointer for std::shared_ptr.
65 *
66 * \ingroup g_utils
67 */
68 template <typename T_>
69 struct RemoveSharedPtr<const T_>
70 {
71 /// T_ with the std::shared_ptr removed.
72 typedef const typename RemoveSharedPtr<T_>::Type Type;
73 };
74
75 /**
76 * Like std::remove_pointer for std::shared_ptr.
77 *
78 * \ingroup g_utils
79 */
80 template <typename T_>
81 struct RemoveSharedPtr<T_ &>
82 {
83 /// T_ with the std::shared_ptr removed.
85 };
86}
87
88#endif
Definition about_metadata-fwd.hh:24
RemoveSharedPtr< T_ >::Type Type
T_ with the std::shared_ptr removed.
Definition remove_shared_ptr.hh:84
const RemoveSharedPtr< T_ >::Type Type
T_ with the std::shared_ptr removed.
Definition remove_shared_ptr.hh:72
T_ Type
T_ with the std::shared_ptr removed.
Definition remove_shared_ptr.hh:48
const T_ Type
T_ with the std::shared_ptr removed.
Definition remove_shared_ptr.hh:60
Definition remove_shared_ptr.hh:34
T_ Type
T_ with the std::shared_ptr removed.
Definition remove_shared_ptr.hh:36