|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r48616 - in trunk: boost/function libs/function/doc libs/function/test
From: dgregor_at_[hidden]
Date: 2008-09-05 12:13:49
Author: dgregor
Date: 2008-09-05 12:13:49 EDT (Fri, 05 Sep 2008)
New Revision: 48616
URL: http://svn.boost.org/trac/boost/changeset/48616
Log:
Add Boost.Typeof support to Boost.Function. Fixes #1621
Added:
trunk/boost/function/function_typeof.hpp (contents, props changed)
trunk/libs/function/test/function_typeof_test.cpp (contents, props changed)
Text files modified:
trunk/boost/function/function_fwd.hpp | 1 +
trunk/libs/function/doc/history.xml | 4 ++++
trunk/libs/function/test/Jamfile.v2 | 2 ++
trunk/libs/function/test/nothrow_swap.cpp | 9 +++++++++
4 files changed, 16 insertions(+), 0 deletions(-)
Modified: trunk/boost/function/function_fwd.hpp
==============================================================================
--- trunk/boost/function/function_fwd.hpp (original)
+++ trunk/boost/function/function_fwd.hpp 2008-09-05 12:13:49 EDT (Fri, 05 Sep 2008)
@@ -66,4 +66,5 @@
typename T10>
class function10;
}
+
#endif
Added: trunk/boost/function/function_typeof.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/function/function_typeof.hpp 2008-09-05 12:13:49 EDT (Fri, 05 Sep 2008)
@@ -0,0 +1,45 @@
+// Boost.Function library - Typeof support
+// Copyright (C) Douglas Gregor 2008
+//
+// Use, modification and distribution is subject to 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)
+//
+// For more information, see http://www.boost.org
+#ifndef BOOST_FUNCTION_TYPEOF_HPP
+#define BOOST_FUNCTION_TYPEOF_HPP
+#include <boost/function/function_fwd.hpp>
+#include <boost/typeof/typeof.hpp>
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+BOOST_TYPEOF_REGISTER_TYPE(boost::bad_function_call)
+
+#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, (typename))
+#endif
+
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function0, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function1, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function2, (typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function3,
+ (typename)(typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function4,
+ (typename)(typename)(typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function5,
+ (typename)(typename)(typename)(typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function6,
+ (typename)(typename)(typename)(typename)(typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function7,
+ (typename)(typename)(typename)(typename)(typename)(typename)(typename)
+ (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function8,
+ (typename)(typename)(typename)(typename)(typename)(typename)(typename)
+ (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function9,
+ (typename)(typename)(typename)(typename)(typename)(typename)(typename)
+ (typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function10,
+ (typename)(typename)(typename)(typename)(typename)(typename)(typename)
+ (typename)(typename)(typename)(typename))
+#endif
Modified: trunk/libs/function/doc/history.xml
==============================================================================
--- trunk/libs/function/doc/history.xml (original)
+++ trunk/libs/function/doc/history.xml 2008-09-05 12:13:49 EDT (Fri, 05 Sep 2008)
@@ -18,6 +18,10 @@
<listitem><para>Improved the performance of Boost.Function's
swap() operation for large function objects. Original patch
contributed by Niels Dekker.</para></listitem>
+
+ <listitem><para>Added a new header <boost/function/function_typeof.hpp> that provides support for using the Boost.Typeof library on Boost.Function objects.</para></listitem>
+
+ <listitem><para>Added a new header <boost/function/function_fwd.hpp> that provides support for using the Boost.Typeof library on Boost.Function objects.</para></listitem>
</itemizedlist>
</listitem>
Modified: trunk/libs/function/test/Jamfile.v2
==============================================================================
--- trunk/libs/function/test/Jamfile.v2 (original)
+++ trunk/libs/function/test/Jamfile.v2 2008-09-05 12:13:49 EDT (Fri, 05 Sep 2008)
@@ -59,6 +59,8 @@
[ run libs/function/test/contains2_test.cpp : : : : ]
[ run libs/function/test/nothrow_swap.cpp : : : : ]
+
+ [ compile libs/function/test/function_typeof_test.cpp ]
;
}
Added: trunk/libs/function/test/function_typeof_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/function/test/function_typeof_test.cpp 2008-09-05 12:13:49 EDT (Fri, 05 Sep 2008)
@@ -0,0 +1,18 @@
+// Boost.Function library
+
+// Copyright Douglas Gregor 2008. Use, modification and
+// distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+#include <boost/function/function_typeof.hpp>
+#include <boost/function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+
+void f(boost::function0<void> f, boost::function0<void> g)
+{
+ BOOST_STATIC_ASSERT((boost::is_same<boost::function0<void>, BOOST_TYPEOF(f = g)>::value));
+}
Modified: trunk/libs/function/test/nothrow_swap.cpp
==============================================================================
--- trunk/libs/function/test/nothrow_swap.cpp (original)
+++ trunk/libs/function/test/nothrow_swap.cpp 2008-09-05 12:13:49 EDT (Fri, 05 Sep 2008)
@@ -1,3 +1,12 @@
+// Boost.Function library
+
+// Copyright Douglas Gregor 2008. Use, modification and
+// distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
#include <boost/test/minimal.hpp>
#include <boost/function.hpp>
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