summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/utils/meta
diff options
context:
space:
mode:
authorschodet2005-01-17 15:04:29 +0000
committerschodet2005-01-17 15:04:29 +0000
commit86c65de3ae99420ca7a2af406a97ade6aa989774 (patch)
tree6023b98ae17f991ba92e6f9a0dc698ee8beb524d /2005/i/robert/src/utils/meta
parented3f0dae905fad5a6659657e7b4ee5f08c00ccd8 (diff)
Initial revision
Diffstat (limited to '2005/i/robert/src/utils/meta')
-rw-r--r--2005/i/robert/src/utils/meta/Makefile.defs5
-rw-r--r--2005/i/robert/src/utils/meta/is_string.hh45
-rw-r--r--2005/i/robert/src/utils/meta/test_is_string.cc35
3 files changed, 85 insertions, 0 deletions
diff --git a/2005/i/robert/src/utils/meta/Makefile.defs b/2005/i/robert/src/utils/meta/Makefile.defs
new file mode 100644
index 0000000..5650f40
--- /dev/null
+++ b/2005/i/robert/src/utils/meta/Makefile.defs
@@ -0,0 +1,5 @@
+PROGRAMS += test_is_string
+
+test_is_string_OBJECTS = test_is_string.o
+
+test_is_string: $(test_is_string_OBJECTS)
diff --git a/2005/i/robert/src/utils/meta/is_string.hh b/2005/i/robert/src/utils/meta/is_string.hh
new file mode 100644
index 0000000..99782d2
--- /dev/null
+++ b/2005/i/robert/src/utils/meta/is_string.hh
@@ -0,0 +1,45 @@
+#ifndef is_string_hh
+#define is_string_hh
+// is_string.hh
+// {{{
+//
+// Copyright (C) 2004 Nicolas Schodet
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program 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.
+//
+// Contact :
+// Web: http://perso.efrei.fr/~schodet/
+// Email: <contact@ni.fr.eu.org>
+// }}}
+
+#include <string>
+
+namespace meta {
+
+template<typename T>
+struct isString
+{
+ static const bool value = false;
+};
+
+template<>
+struct isString<std::string>
+{
+ static const bool value = true;
+};
+
+} // namespace meta
+
+#endif // is_string_hh
diff --git a/2005/i/robert/src/utils/meta/test_is_string.cc b/2005/i/robert/src/utils/meta/test_is_string.cc
new file mode 100644
index 0000000..c61483a
--- /dev/null
+++ b/2005/i/robert/src/utils/meta/test_is_string.cc
@@ -0,0 +1,35 @@
+// test_is_string.cc
+// {{{
+//
+// Copyright (C) 2004 Nicolas Schodet
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program 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.
+//
+// Contact :
+// Web: http://perso.efrei.fr/~schodet/
+// Email: <contact@ni.fr.eu.org>
+// }}}
+#include "is_string.hh"
+
+#include <iostream>
+
+int
+main (void)
+{
+ std::cout << "std::string " << meta::isString<std::string>::value << std::endl;
+ std::cout << "int " << meta::isString<int>::value << std::endl;
+ std::cout << "char * " << meta::isString<char *>::value << std::endl;
+ return 0;
+}