diff options
author | 2011-02-06 19:03:48 +0000 | |
---|---|---|
committer | 2011-02-06 19:03:48 +0000 | |
commit | 4eb98040ac02186b9c2e9dd1f2cd5e7259f7b83b (patch) | |
tree | 8c95a6fcbeead91772ef8912b5ea8a8daffb54fc | |
parent | 4a67573716c63338ce4537019c94dc7a795eb71d (diff) | |
download | paludis-4eb98040ac02186b9c2e9dd1f2cd5e7259f7b83b.tar.gz paludis-4eb98040ac02186b9c2e9dd1f2cd5e7259f7b83b.tar.xz |
We can use std::conditional now
-rw-r--r-- | paludis/spec_tree.hh | 12 | ||||
-rw-r--r-- | paludis/util/files.m4 | 1 | ||||
-rw-r--r-- | paludis/util/select.hh | 99 |
3 files changed, 6 insertions, 106 deletions
diff --git a/paludis/spec_tree.hh b/paludis/spec_tree.hh index 424fc33c0..37b09967f 100644 --- a/paludis/spec_tree.hh +++ b/paludis/spec_tree.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2009, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -22,9 +22,9 @@ #include <paludis/spec_tree-fwd.hh> #include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/util/select.hh> #include <paludis/util/simple_visitor.hh> #include <paludis/util/sequence.hh> +#include <type_traits> namespace paludis { @@ -154,15 +154,15 @@ namespace paludis template <typename Node_> struct NodeType { - typedef typename Select< + typedef typename std::conditional< TypeListContains<VisitableTypeList, typename LeafNodeType<Node_>::Type>::value, typename SpecTree::template LeafNodeType<Node_>::Type, - typename Select< + typename std::conditional< TypeListContains<VisitableTypeList, typename InnerNodeType<Node_>::Type>::value, typename InnerNodeType<Node_>::Type, spec_tree_internals::TreeCannotContainNodeType<SpecTree, Node_> - >::Type - >::Type Type; + >::type + >::type Type; }; explicit SpecTree(const std::shared_ptr<RootNode_> & spec); diff --git a/paludis/util/files.m4 b/paludis/util/files.m4 index 00962b018..ea16e2b48 100644 --- a/paludis/util/files.m4 +++ b/paludis/util/files.m4 @@ -71,7 +71,6 @@ add(`rmd160', `hh', `cc', `test') add(`safe_ifstream', `hh', `cc', `fwd', `test', `testscript') add(`safe_ofstream', `hh', `cc', `test', `testscript') add(`save', `hh', `test') -add(`select', `hh') add(`sequence', `hh', `fwd', `impl', `cc') add(`set', `hh', `fwd', `impl', `cc') add(`sha1', `hh', `cc', `test') diff --git a/paludis/util/select.hh b/paludis/util/select.hh deleted file mode 100644 index a399811f6..000000000 --- a/paludis/util/select.hh +++ /dev/null @@ -1,99 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_UTIL_SR_HH -#define PALUDIS_GUARD_PALUDIS_UTIL_SR_HH 1 - -#include <paludis/util/attributes.hh> - -/** \file - * Declarations for various metaprogramming utility classes. - * - * \ingroup g_oo - * - * \section Examples - * - * - None at this time. - */ - -namespace paludis -{ - template <bool value_, typename IfTrue_, typename IfFalse_> - struct Select; - - /** - * Metaprogramming: select a type based upon a condition. - * - * \ingroup g_oo - */ - template <typename IfTrue_, typename IfFalse_> - struct Select<true, IfTrue_, IfFalse_> - { - /// Our value. - typedef IfTrue_ Type; - }; - - /** - * Metaprogramming: select a type based upon a condition. - * - * \ingroup g_oo - */ - template <typename IfTrue_, typename IfFalse_> - struct Select<false, IfTrue_, IfFalse_> - { - /// Our value. - typedef IfFalse_ Type; - }; - - template <bool value_> - struct SelectValue; - - /** - * Metaprogramming: select a value based upon a condition. - * - * \ingroup g_oo - */ - template <> - struct SelectValue<true> - { - template <typename IfTrue_, typename IfFalse_> - static const IfTrue_ & get(const IfTrue_ & v, const IfFalse_ &) - { - return v; - } - }; - - /** - * Metaprogramming: select a value based upon a condition. - * - * \ingroup g_oo - */ - template <> - struct SelectValue<false> - { - template <typename IfTrue_, typename IfFalse_> - static const IfFalse_ & get(const IfTrue_ &, const IfFalse_ & v) - { - return v; - } - }; -} - -#endif - |