remove_shared_ptr.hh

00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
00005  *
00006  * This file is part of the Paludis package manager. Paludis is free software;
00007  * you can redistribute it and/or modify it under the terms of the GNU General
00008  * Public License version 2, as published by the Free Software Foundation.
00009  *
00010  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef PALUDIS_GUARD_PALUDIS_UTIL_REMOVE_SHARED_PTR_HH
00021 #define PALUDIS_GUARD_PALUDIS_UTIL_REMOVE_SHARED_PTR_HH 1
00022 
00023 #include <tr1/memory>
00024 
00025 namespace paludis
00026 {
00027     /**
00028      * Like std::tr1::remove_pointer for std::tr1::shared_ptr.
00029      *
00030      * \ingroup g_utils
00031      */
00032     template <typename T_>
00033     struct RemoveSharedPtr
00034     {
00035         /// T_ with the std::tr1::shared_ptr removed.
00036         typedef T_ Type;
00037     };
00038 
00039     /**
00040      * Like std::tr1::remove_pointer for std::tr1::shared_ptr.
00041      *
00042      * \ingroup g_utils
00043      */
00044     template <typename T_>
00045     struct RemoveSharedPtr<std::tr1::shared_ptr<T_> >
00046     {
00047         /// T_ with the std::tr1::shared_ptr removed.
00048         typedef T_ Type;
00049     };
00050 
00051     /**
00052      * Like std::tr1::remove_pointer for std::tr1::shared_ptr.
00053      *
00054      * \ingroup g_utils
00055      */
00056     template <typename T_>
00057     struct RemoveSharedPtr<std::tr1::shared_ptr<const T_> >
00058     {
00059         /// T_ with the std::tr1::shared_ptr removed.
00060         typedef const T_ Type;
00061     };
00062 
00063     /**
00064      * Like std::tr1::remove_pointer for std::tr1::shared_ptr.
00065      *
00066      * \ingroup g_utils
00067      */
00068     template <typename T_>
00069     struct RemoveSharedPtr<const T_>
00070     {
00071         /// T_ with the std::tr1::shared_ptr removed.
00072         typedef const typename RemoveSharedPtr<T_>::Type Type;
00073     };
00074 
00075     /**
00076      * Like std::tr1::remove_pointer for std::tr1::shared_ptr.
00077      *
00078      * \ingroup g_utils
00079      */
00080     template <typename T_>
00081     struct RemoveSharedPtr<T_ &>
00082     {
00083         /// T_ with the std::tr1::shared_ptr removed.
00084         typedef typename RemoveSharedPtr<T_>::Type Type;
00085     };
00086 }
00087 
00088 #endif

Generated on Mon Sep 21 10:36:08 2009 for paludis by  doxygen 1.5.4