Boost logo

Boost-Commit :

From: oryol_at_[hidden]
Date: 2008-08-14 23:19:05


Author: jeremypack
Date: 2008-08-14 23:19:05 EDT (Thu, 14 Aug 2008)
New Revision: 48149
URL: http://svn.boost.org/trac/boost/changeset/48149

Log:
Add additional headers for adaptable factory
Added:
   sandbox/boost/extension/impl/create.hpp (contents, props changed)
   sandbox/boost/extension/impl/create_func.hpp (contents, props changed)
Text files modified:
   sandbox/boost/extension/type_map.hpp | 5 -----
   1 files changed, 0 insertions(+), 5 deletions(-)

Added: sandbox/boost/extension/impl/create.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/impl/create.hpp 2008-08-14 23:19:05 EDT (Thu, 14 Aug 2008)
@@ -0,0 +1,36 @@
+/*
+ * Boost.Extension / factory:
+ * factory to register the implementations and create them
+ *
+ * (C) Copyright Jeremy Pack 2008
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+#ifndef BOOST_EXTENSION_IMPL_CREATE_HPP
+#define BOOST_EXTENSION_IMPL_CREATE_HPP
+namespace boost {
+namespace extensions {
+namespace impl {
+
+#define N BOOST_EXTENSION_MAX_FUNCTOR_PARAMS
+template <class T, class D
+ BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \
+ BOOST_PP_INC(N), class Param, void) >
+struct create_function;
+#undef N
+
+// generate specializations of create_func
+# define BOOST_PP_ITERATION_LIMITS \
+ (0, BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS) - 1)
+# define BOOST_PP_FILENAME_1 <boost/extension/impl/create_func.hpp>
+# include BOOST_PP_ITERATE()
+} // namespace impl
+} // namespace extensions
+} // namespace boost
+
+#endif // BOOST_EXTENSION_IMPL_CREATE_HPP

Added: sandbox/boost/extension/impl/create_func.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/impl/create_func.hpp 2008-08-14 23:19:05 EDT (Thu, 14 Aug 2008)
@@ -0,0 +1,38 @@
+/*
+ * Copyright Jeremy Pack 2008
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
+// No header guard - this file is intended to be included multiple times.
+
+# define N BOOST_PP_ITERATION()
+template <
+ class T,
+ class D
+ BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class Param)
+>
+struct create_function<
+ T,
+ D
+ BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param)
+> {
+ static T * create(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p) ) {
+ return new D(BOOST_PP_ENUM_PARAMS(N, p));
+ }
+};
+
+template <
+ class T,
+ class D
+ BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class Param)
+>
+static T* create_derived(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) {
+ return new D(BOOST_PP_ENUM_PARAMS(N, p));
+}
+#undef N
+

Modified: sandbox/boost/extension/type_map.hpp
==============================================================================
--- sandbox/boost/extension/type_map.hpp (original)
+++ sandbox/boost/extension/type_map.hpp 2008-08-14 23:19:05 EDT (Thu, 14 Aug 2008)
@@ -17,8 +17,6 @@
 #include <boost/extension/impl/typeinfo.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/remove_const.hpp>
-#include <boost/type_traits/has_nothrow_assign.hpp>
-#include <boost/type_traits/has_nothrow_copy_constructor.hpp>
 
 namespace boost {
 namespace extensions {
@@ -51,9 +49,6 @@
 template <class TypeInfo>
 class basic_type_map {
 public:
-// Some assertions about the TypeInfo type.
- BOOST_STATIC_ASSERT(has_nothrow_assign<TypeInfo>::value);
- BOOST_STATIC_ASSERT(has_nothrow_copy_constructor<TypeInfo>::value);
 
 #ifndef BOOST_EXTENSION_DOXYGEN_INVOKED
   class type_map_convertible {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk