aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-23 16:47:54 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-23 23:08:06 +0100
commit9df50426a7b3080e5ebcb077e2f7fc8ac2cf2681 (patch)
tree69d36a4d0d5dbe2c11e054e4c636b5a133976bfc
parentfadfd3ea6e287003b21c973337e64e215aca4c4a (diff)
downloadpaludis-9df50426a7b3080e5ebcb077e2f7fc8ac2cf2681.tar.gz
paludis-9df50426a7b3080e5ebcb077e2f7fc8ac2cf2681.tar.xz
New NamedValue voodoo.
Eventually this will replace kc and sr. It's much simpler, and quite a bit cruder.
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/make_named_values.cc21
-rw-r--r--paludis/util/make_named_values.hh404
-rw-r--r--paludis/util/named_value-fwd.hh41
-rw-r--r--paludis/util/named_value.cc21
-rw-r--r--paludis/util/named_value.hh70
6 files changed, 559 insertions, 0 deletions
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 65ea02c..0634217 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -36,11 +36,13 @@ add(`join', `hh', `test')
add(`kc', `hh', `fwd')
add(`keys', `hh')
add(`log', `hh', `cc', `se', `test')
+add(`make_named_values', `hh', `cc')
add(`make_shared_ptr', `hh', `fwd')
add(`map', `hh', `fwd', `impl', `cc')
add(`member_iterator', `hh', `fwd', `impl', `test')
add(`md5', `hh', `cc', `test')
add(`mutex', `hh', `cc', `fwd', `test')
+add(`named_value', `hh', `cc', `fwd')
add(`no_type', `hh')
add(`operators', `hh')
add(`options', `hh', `fwd', `cc', `test')
diff --git a/paludis/util/make_named_values.cc b/paludis/util/make_named_values.cc
new file mode 100644
index 0000000..e62e18f
--- /dev/null
+++ b/paludis/util/make_named_values.cc
@@ -0,0 +1,21 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ */
+
+#include <paludis/util/make_named_values.hh>
+
diff --git a/paludis/util/make_named_values.hh b/paludis/util/make_named_values.hh
new file mode 100644
index 0000000..8759f9f
--- /dev/null
+++ b/paludis/util/make_named_values.hh
@@ -0,0 +1,404 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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_MAKE_NAMED_VALUES_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_MAKE_NAMED_VALUES_HH 1
+
+/** \file
+ * A load of make_named_values functions.
+ *
+ * Bizarre oddity in C++98: you can only use an initialiser list when using
+ * equals to initialise a newly constructed object. C++0x fixes this, but in the
+ * mean time we can hack around it with this mess...
+ */
+
+namespace paludis
+{
+ template <typename R_, typename T1_>
+ R_ make_named_values(const T1_ & v1)
+ {
+ R_ result = { v1 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2)
+ {
+ R_ result = { v1, v2 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3)
+ {
+ R_ result = { v1, v2, v3 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4)
+ {
+ R_ result = { v1, v2, v3, v4 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5)
+ {
+ R_ result = { v1, v2, v3, v4, v5 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_, typename T22_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21, const T22_ & v22)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21, v22 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_, typename T22_, typename T23_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21, const T22_ & v22, const T23_ & v23)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21, v22, v23 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_, typename T22_, typename T23_, typename T24_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21, const T22_ & v22, const T23_ & v23, const T24_ & v24)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21, v22, v23, v24 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_, typename T22_, typename T23_, typename T24_, typename T25_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21, const T22_ & v22, const T23_ & v23, const T24_ & v24, const T25_ & v25)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21, v22, v23, v24, v25 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_, typename T22_, typename T23_, typename T24_, typename T25_,
+ typename T26_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21, const T22_ & v22, const T23_ & v23, const T24_ & v24, const T25_ & v25,
+ const T26_ & v26)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21, v22, v23, v24, v25, v26 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_, typename T22_, typename T23_, typename T24_, typename T25_,
+ typename T26_, typename T27_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21, const T22_ & v22, const T23_ & v23, const T24_ & v24, const T25_ & v25,
+ const T26_ & v26, const T27_ & v27)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21, v22, v23, v24, v25, v26, v27 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_, typename T22_, typename T23_, typename T24_, typename T25_,
+ typename T26_, typename T27_, typename T28_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21, const T22_ & v22, const T23_ & v23, const T24_ & v24, const T25_ & v25,
+ const T26_ & v26, const T27_ & v27, const T28_ & v28)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21, v22, v23, v24, v25, v26, v27, v28 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_, typename T22_, typename T23_, typename T24_, typename T25_,
+ typename T26_, typename T27_, typename T28_, typename T29_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21, const T22_ & v22, const T23_ & v23, const T24_ & v24, const T25_ & v25,
+ const T26_ & v26, const T27_ & v27, const T28_ & v28, const T29_ & v29)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21, v22, v23, v24, v25, v26, v27, v28, v29 };
+ return result;
+ }
+
+ template <typename R_, typename T1_, typename T2_, typename T3_, typename T4_, typename T5_,
+ typename T6_, typename T7_, typename T8_, typename T9_, typename T10_,
+ typename T11_, typename T12_, typename T13_, typename T14_, typename T15_,
+ typename T16_, typename T17_, typename T18_, typename T19_, typename T20_,
+ typename T21_, typename T22_, typename T23_, typename T24_, typename T25_,
+ typename T26_, typename T27_, typename T28_, typename T29_, typename T30_>
+ R_ make_named_values(const T1_ & v1, const T2_ & v2, const T3_ & v3, const T4_ & v4, const T5_ & v5,
+ const T6_ & v6, const T7_ & v7, const T8_ & v8, const T9_ & v9, const T10_ & v10,
+ const T11_ & v11, const T12_ & v12, const T13_ & v13, const T14_ & v14, const T15_ & v15,
+ const T16_ & v16, const T17_ & v17, const T18_ & v18, const T19_ & v19, const T20_ & v20,
+ const T21_ & v21, const T22_ & v22, const T23_ & v23, const T24_ & v24, const T25_ & v25,
+ const T26_ & v26, const T27_ & v27, const T28_ & v28, const T29_ & v29, const T30_ & v30)
+ {
+ R_ result = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20,
+ v21, v22, v23, v24, v25, v26, v27, v28, v29, v30 };
+ return result;
+ }
+}
+
+#endif
diff --git a/paludis/util/named_value-fwd.hh b/paludis/util/named_value-fwd.hh
new file mode 100644
index 0000000..eca97e7
--- /dev/null
+++ b/paludis/util/named_value-fwd.hh
@@ -0,0 +1,41 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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_NAMED_VALUE_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_NAMED_VALUE_FWD_HH 1
+
+#include <string>
+
+namespace paludis
+{
+ template <typename K_, typename V_>
+ class NamedValue;
+
+ template <typename K_, typename V_>
+ NamedValue<K_, V_>
+ value_for(const V_ & v);
+
+ /* Hack: let "foo" work for strings, but ban other magic conversions */
+ template <typename K_>
+ NamedValue<K_, std::string>
+ value_for(const char * const v);
+
+}
+
+#endif
diff --git a/paludis/util/named_value.cc b/paludis/util/named_value.cc
new file mode 100644
index 0000000..e074f8f
--- /dev/null
+++ b/paludis/util/named_value.cc
@@ -0,0 +1,21 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ */
+
+#include <paludis/util/named_value.hh>
+
diff --git a/paludis/util/named_value.hh b/paludis/util/named_value.hh
new file mode 100644
index 0000000..4d45616
--- /dev/null
+++ b/paludis/util/named_value.hh
@@ -0,0 +1,70 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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_NAMED_VALUE_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_NAMED_VALUE_HH 1
+
+#include <paludis/util/named_value-fwd.hh>
+
+namespace paludis
+{
+ template <typename K_, typename V_>
+ class NamedValue
+ {
+ private:
+ V_ _value;
+
+ public:
+ explicit NamedValue(const V_ & v) :
+ _value(v)
+ {
+ }
+
+ NamedValue(const NamedValue & v) :
+ _value(v._value)
+ {
+ }
+
+ V_ & operator() ()
+ {
+ return _value;
+ }
+
+ const V_ & operator() () const
+ {
+ return _value;
+ }
+ };
+
+ template <typename K_, typename V_>
+ NamedValue<K_, V_>
+ value_for(const V_ & v)
+ {
+ return NamedValue<K_, V_>(v);
+ }
+
+ template <typename K_>
+ NamedValue<K_, std::string>
+ value_for(const char * const v)
+ {
+ return NamedValue<K_, std::string>(v);
+ }
+}
+
+#endif