Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49137 - in branches/bcbboost/libs: graph/test numeric/ublas/test proto/doc spirit/phoenix/test/algorithm spirit/phoenix/test/bind spirit/phoenix/test/container spirit/phoenix/test/scope thread/test
From: nicola.musatti_at_[hidden]
Date: 2008-10-05 04:23:29


Author: nmusatti
Date: 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
New Revision: 49137
URL: http://svn.boost.org/trac/boost/changeset/49137

Log:
Merge from trunk
Added:
   branches/bcbboost/libs/graph/test/is_straight_line_draw_test.cpp
      - copied unchanged from r49136, /trunk/libs/graph/test/is_straight_line_draw_test.cpp
Text files modified:
   branches/bcbboost/libs/graph/test/Jamfile.v2 | 2
   branches/bcbboost/libs/numeric/ublas/test/placement_new.cpp | 1
   branches/bcbboost/libs/proto/doc/grammars.qbk | 150 ++++++++++++++++++++++++++++++++++++++-
   branches/bcbboost/libs/proto/doc/preface.qbk | 4
   branches/bcbboost/libs/proto/doc/propdocs.sh | 7 -
   branches/bcbboost/libs/proto/doc/proto.qbk | 2
   branches/bcbboost/libs/spirit/phoenix/test/algorithm/iteration.cpp | 2
   branches/bcbboost/libs/spirit/phoenix/test/algorithm/querying.cpp | 2
   branches/bcbboost/libs/spirit/phoenix/test/algorithm/querying2.cpp | 2
   branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation1.cpp | 2
   branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation2.cpp | 2
   branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation3.cpp | 2
   branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation4.cpp | 2
   branches/bcbboost/libs/spirit/phoenix/test/bind/bind_function_object_tests.cpp | 6 +
   branches/bcbboost/libs/spirit/phoenix/test/container/container_tests.hpp | 2
   branches/bcbboost/libs/spirit/phoenix/test/scope/bug_000008.cpp | 1
   branches/bcbboost/libs/spirit/phoenix/test/scope/dynamic_tests.cpp | 2
   branches/bcbboost/libs/thread/test/test_thread_move.cpp | 40 ++++++++--
   18 files changed, 200 insertions(+), 31 deletions(-)

Modified: branches/bcbboost/libs/graph/test/Jamfile.v2
==============================================================================
--- branches/bcbboost/libs/graph/test/Jamfile.v2 (original)
+++ branches/bcbboost/libs/graph/test/Jamfile.v2 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -135,6 +135,8 @@
 
     [ run r_c_shortest_paths_test.cpp ]
 
+ [ run is_straight_line_draw_test.cpp ]
+
     $(optional_tests)
     ;
 

Modified: branches/bcbboost/libs/numeric/ublas/test/placement_new.cpp
==============================================================================
--- branches/bcbboost/libs/numeric/ublas/test/placement_new.cpp (original)
+++ branches/bcbboost/libs/numeric/ublas/test/placement_new.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -12,6 +12,7 @@
 
 #include <boost/numeric/ublas/storage.hpp>
 #include <iostream>
+#include <new>
 
 // User defined type to capture base pointer on construction
 

Modified: branches/bcbboost/libs/proto/doc/grammars.qbk
==============================================================================
--- branches/bcbboost/libs/proto/doc/grammars.qbk (original)
+++ branches/bcbboost/libs/proto/doc/grammars.qbk 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -297,11 +297,153 @@
 
 [endsect]
 
-[/==========================]
-[section:switch [^switch_<>]]
-[/==========================]
+[/=======================================================]
+[section:switch Improving Compile Times With [^switch_<>]]
+[/=======================================================]
 
-TODO document proto::switch_<>
+When your Proto grammar gets large, you'll start to run into some scalability problems with _or_, the construct you use to specify alternate sub-grammars. First, due to limitations in C++, _or_ can only accept up to a certain number of sub-grammars, controlled by the `BOOST_PROTO_MAX_LOGICAL_ARITY` macro. This macro defaults to eight, and you can set it higher, but doing so will aggravate another scalability problem: long compile times. With _or_, alternate sub-grammars are tried in order -- like a series of cascading `if`'s -- leading to lots of unnecessary template instantiations. What you would prefer instead is something like `switch` that avoids the expense of cascading `if`'s. That's the purpose of _switch_; although less convenient than _or_, it improves compile times for larger grammars and does not have an arbitrary fixed limit on the number of sub-grammars.
+
+Let's illustrate how to use _switch_ by first writing a big grammar with _or_ and then translating it to an equivalent grammar using _switch_:
+
+ // Here is a big, inneficient grammar
+ struct ABigGrammar
+ : proto::or_<
+ proto::terminal<int>
+ , proto::terminal<double>
+ , proto::unary_plus<ABigGrammar>
+ , proto::negate<ABigGrammar>
+ , proto::complement<ABigGrammar>
+ , proto::plus<ABigGrammar, ABigGrammar>
+ , proto::minus<ABigGrammar, ABigGrammar>
+ , proto::or_<
+ proto::multiplies<ABigGrammar, ABigGrammar>
+ , proto::divides<ABigGrammar, ABigGrammar>
+ , proto::modulus<ABigGrammar, ABigGrammar>
+ >
+ >
+ {};
+
+The above might be the grammar to a more ellaborate calculator DSEL. Notice that since there are more than eight sub-grammars, we had to chain the sub-grammars with a nested _or_ -- not nice.
+
+The idea behind _switch_ is to dispatch based on an expression's tag type to a sub-grammar that handles expressions of that type. To use _switch_, you define a struct with a nested `case_<>` template, specialized on tag types. The above grammar can be expressed using _switch_ as follows. It is described below.
+
+ // Redefine ABigGrammar more efficiently using proto::switch_<>
+ struct ABigGrammar;
+
+ struct ABigGrammarCases
+ {
+ // The primary template matches nothing:
+ template<typename Tag>
+ struct case_
+ : proto::not_<_>
+ {};
+ };
+
+ // Terminal expressions are handled here
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::terminal>
+ : proto::or_<
+ proto::terminal<int>
+ , proto::terminal<double>
+ >
+ {};
+
+ // Non-terminals are handled similarly
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::unary_plus>
+ : proto::unary_plus<ABigGrammar>
+ {};
+
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::negate>
+ : proto::negate<ABigGrammar>
+ {};
+
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::complement>
+ : proto::complement<ABigGrammar>
+ {};
+
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::plus>
+ : proto::plus<ABigGrammar, ABigGrammar>
+ {};
+
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::minus>
+ : proto::minus<ABigGrammar, ABigGrammar>
+ {};
+
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::multiplies>
+ : proto::multiplies<ABigGrammar, ABigGrammar>
+ {};
+
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::divides>
+ : proto::divides<ABigGrammar, ABigGrammar>
+ {};
+
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::modulus>
+ : proto::modulus<ABigGrammar, ABigGrammar>
+ {};
+
+ // Define ABigGrammar in terms of ABigGrammarCases
+ // using proto::switch_<>
+ struct ABigGrammar
+ : proto::switch_<ABigGrammarCases>
+ {};
+
+Matching an expression type `E` against `proto::switch_<C>` is equivalent to matching it against `C::case_<E::proto_tag>`. By dispatching on the expression's tag type, we can jump to the sub-grammar that handles expressions of that type, skipping over all the other sub-grammars that couldn't possibly match. If there is no specialization of `case_<>` for a particular tag type, we select the primary template. In this case, the primary template inherits from `proto::not_<_>` which matches no expressions.
+
+Notice the specialization that handles terminals:
+
+ // Terminal expressions are handled here
+ template<>
+ struct ABigGrammarCases::case_<proto::tag::terminal>
+ : proto::or_<
+ proto::terminal<int>
+ , proto::terminal<double>
+ >
+ {};
+
+The `proto::tag::terminal` type by itself isn't enough to select an appropriate sub-grammar, so we use _or_ to list the alternate sub-grammars that match terminals.
+
+[note You might be tempted to define your `case_<>` specializations /in situ/ as follows:
+
+``
+ struct ABigGrammarCases
+ {
+ template<typename Tag>
+ struct case_ : proto::not_<_> {};
+
+ // ERROR: not legal C++
+ template<>
+ struct case_<proto::tag::terminal>
+ /* ... as defined above ... */
+ };
+``
+
+Unfortunately, for arcane reasons, it is not legal to define an explicit nested specialization /in situ/ like this. It is, however, perfectly legal to define /partial/ specializations /in situ/, so you can add a extra dummy template parameter that has a default, as follows:
+
+``
+ struct ABigGrammarCases
+ {
+ // Note extra "Dummy" template parameter here:
+ template<typename Tag, int Dummy = 0>
+ struct case_ : proto::not_<_> {};
+
+ // OK: "Dummy" makes this a partial specialization
+ // instead of an explicit specialization.
+ template<int Dummy>
+ struct case_<proto::tag::terminal, Dummy>
+ /* ... as defined above */
+ };
+``
+
+You might find this cleaner that defining explicit `case_<>` specializations outside of their enclosing struct.
+]
 
 [endsect]
 

Modified: branches/bcbboost/libs/proto/doc/preface.qbk
==============================================================================
--- branches/bcbboost/libs/proto/doc/preface.qbk (original)
+++ branches/bcbboost/libs/proto/doc/preface.qbk 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -25,7 +25,7 @@
 
 [heading Motivation]
 
-Expression Templates are an advanced technique that C++ library developers use to define embedded mini-languages that target specific problem domains. The technique has been used to create efficient and easy-to-use libraries for linear algebra as well as to define C++ parser generators with a readable syntax. But developing such a library involves writing an inordinate amount of unreadable and unmaintainable template mumbo-jumbo. Boost.Proto eases the development of [link boost_proto.users_guide.glossary.dsel domain-specific embedded languages (DSELs)]. Use Proto to define the primitives of your mini-language and let Proto handle the operator overloading and the construction of the expression parse tree. Immediately evaluate the expression tree by passing it a function object. Or transform the expression tree by defining the grammar of your mini-language, decoratedwith an assortment of tree transforms provided by Proto or defined by you. Then use the grammar to give your users short and readable syntax erro
rs for invalid expressions! No more mumbo-jumbo -- an expression template library developed with Proto is declarative and readable.
+Expression Templates are an advanced technique that C++ library developers use to define embedded mini-languages that target specific problem domains. The technique has been used to create efficient and easy-to-use libraries for linear algebra as well as to define C++ parser generators with a readable syntax. But developing such a library involves writing an inordinate amount of unreadable and unmaintainable template mumbo-jumbo. Boost.Proto eases the development of [link boost_proto.users_guide.glossary.dsel domain-specific embedded languages (DSELs)]. Use Proto to define the primitives of your mini-language and let Proto handle the operator overloading and the construction of the expression parse tree. Immediately evaluate the expression tree by passing it a function object. Or transform the expression tree by defining the grammar of your mini-language, decorated with an assortment of tree transforms provided by Proto or defined by you. Then use the grammar to give your users short and readable syntax err
ors for invalid expressions! No more mumbo-jumbo -- an expression template library developed with Proto is declarative and readable.
 
 In short, Proto is a DSEL for defining DSELs.
 
@@ -66,6 +66,4 @@
     // Allow unqualified use of Proto's wildcard pattern
     using proto::_;
 
-In addition to the above, `mpl` is a namespace alias for `boost::mpl`, and `fusion` is an alias for `boost::fusion`.
-
 [endsect]

Modified: branches/bcbboost/libs/proto/doc/propdocs.sh
==============================================================================
--- branches/bcbboost/libs/proto/doc/propdocs.sh (original)
+++ branches/bcbboost/libs/proto/doc/propdocs.sh 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -1,8 +1,3 @@
 #!/bin/sh
 
-rm html.tar.gz
-tar -czf html.tar.gz html
-
-scp html.tar.gz eric_niebler_at_[hidden]:/home/groups/b/bo/boost-sandbox/htdocs/libs/proto/doc
-ssh eric_niebler_at_[hidden] 'cd /home/groups/b/bo/boost-sandbox/htdocs/libs/proto/doc; rm -rf html; tar -xzf html.tar.gz'
-
+rsync --delete --rsh=ssh --recursive html/* eric_niebler,boost-sandbox_at_[hidden]:/home/groups/b/bo/boost-sandbox/htdocs/libs/proto/doc/html

Modified: branches/bcbboost/libs/proto/doc/proto.qbk
==============================================================================
--- branches/bcbboost/libs/proto/doc/proto.qbk (original)
+++ branches/bcbboost/libs/proto/doc/proto.qbk 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -69,6 +69,8 @@
   [classref boost::proto::control::if_ `proto::if_<>`]]
 [def _not_
   [classref boost::proto::control::not_ `proto::not_<>`]]
+[def _switch_
+ [classref boost::proto::control::switch_ `proto::switch_<>`]]
 [def _exact_
   [classref boost::proto::control::exact `proto::exact<>`]]
 [def _convertible_to_

Modified: branches/bcbboost/libs/spirit/phoenix/test/algorithm/iteration.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/algorithm/iteration.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/algorithm/iteration.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
-#include <boost/spirit/include/phoenix_stl.hpp/iteration.hpp>
+#include <boost/spirit/home/phoenix/stl/algorithm/iteration.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/detail/lightweight_test.hpp>
 

Modified: branches/bcbboost/libs/spirit/phoenix/test/algorithm/querying.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/algorithm/querying.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/algorithm/querying.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -7,7 +7,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
-#include <boost/spirit/include/phoenix_stl.hpp/querying.hpp>
+#include <boost/spirit/home/phoenix/stl/algorithm/querying.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/detail/lightweight_test.hpp>
 

Modified: branches/bcbboost/libs/spirit/phoenix/test/algorithm/querying2.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/algorithm/querying2.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/algorithm/querying2.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
-#include <boost/spirit/include/phoenix_stl.hpp/querying.hpp>
+#include <boost/spirit/home/phoenix/stl/algorithm/querying.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/detail/lightweight_test.hpp>
 

Modified: branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation1.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation1.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation1.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
-#include <boost/spirit/include/phoenix_stl.hpp/transformation.hpp>
+#include <boost/spirit/home/phoenix/stl/algorithm/transformation.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/detail/lightweight_test.hpp>
 

Modified: branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation2.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation2.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation2.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
-#include <boost/spirit/include/phoenix_stl.hpp/transformation.hpp>
+#include <boost/spirit/home/phoenix/stl/algorithm/transformation.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/detail/lightweight_test.hpp>
 

Modified: branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation3.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation3.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation3.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
-#include <boost/spirit/phoenix/stl/algorithm/transformation.hpp>
+#include <boost/spirit/home/phoenix/stl/algorithm/transformation.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/detail/lightweight_test.hpp>
 

Modified: branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation4.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation4.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/algorithm/transformation4.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
-#include <boost/spirit/phoenix/stl/algorithm/transformation.hpp>
+#include <boost/spirit/home/phoenix/stl/algorithm/transformation.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/detail/lightweight_test.hpp>
 

Modified: branches/bcbboost/libs/spirit/phoenix/test/bind/bind_function_object_tests.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/bind/bind_function_object_tests.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/bind/bind_function_object_tests.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -101,6 +101,12 @@
     int const ic5 = 5;
     // testing consts
     BOOST_TEST(bind(sqr(), arg1)(ic5) == (ic5*ic5));
+
+ // From Steven Watanabe
+ sqr s;
+ int x = 2;
+ int result = bind(ref(s), _1)(x);
+ BOOST_TEST(result == 4);
 
     return boost::report_errors();
 }

Modified: branches/bcbboost/libs/spirit/phoenix/test/container/container_tests.hpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/container/container_tests.hpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/container/container_tests.hpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -9,7 +9,7 @@
 
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/phoenix/stl/container/container.hpp>
+#include <boost/spirit/home/phoenix/stl/container/container.hpp>
 
 #include <iostream>
 #include <typeinfo>

Modified: branches/bcbboost/libs/spirit/phoenix/test/scope/bug_000008.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/scope/bug_000008.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/scope/bug_000008.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -15,6 +15,7 @@
 #include <boost/config.hpp>
 #include <boost/assert.hpp>
 #include <boost/detail/lightweight_test.hpp>
+#include <boost/spirit/home/phoenix/scope/dynamic.hpp>
 
 #if defined(DONT_HAVE_BOOST) \
     || !defined(BOOST_HAS_THREADS) \

Modified: branches/bcbboost/libs/spirit/phoenix/test/scope/dynamic_tests.cpp
==============================================================================
--- branches/bcbboost/libs/spirit/phoenix/test/scope/dynamic_tests.cpp (original)
+++ branches/bcbboost/libs/spirit/phoenix/test/scope/dynamic_tests.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -12,7 +12,7 @@
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
-#include <boost/spirit/include/phoenix_scope.hpp>
+#include <boost/spirit/home/phoenix/scope/dynamic.hpp>
 
 struct my_dynamic : ::boost::phoenix::dynamic<int, std::string, double>
 {

Modified: branches/bcbboost/libs/thread/test/test_thread_move.cpp
==============================================================================
--- branches/bcbboost/libs/thread/test/test_thread_move.cpp (original)
+++ branches/bcbboost/libs/thread/test/test_thread_move.cpp 2008-10-05 04:23:27 EDT (Sun, 05 Oct 2008)
@@ -5,38 +5,59 @@
 #include <boost/thread/thread.hpp>
 #include <boost/test/unit_test.hpp>
 
-void do_nothing()
-{}
+void do_nothing(boost::thread::id* my_id)
+{
+ *my_id=boost::this_thread::get_id();
+}
 
 void test_move_on_construction()
 {
- boost::thread x=boost::thread(do_nothing);
+ boost::thread::id the_id;
+ boost::thread x=boost::thread(do_nothing,&the_id);
+ boost::thread::id x_id=x.get_id();
     x.join();
+ BOOST_CHECK_EQUAL(the_id,x_id);
 }
 
-boost::thread make_thread()
+boost::thread make_thread(boost::thread::id* the_id)
 {
- return boost::thread(do_nothing);
+ return boost::thread(do_nothing,the_id);
 }
 
 void test_move_from_function_return()
 {
- boost::thread x=make_thread();
+ boost::thread::id the_id;
+ boost::thread x=make_thread(&the_id);
+ boost::thread::id x_id=x.get_id();
     x.join();
+ BOOST_CHECK_EQUAL(the_id,x_id);
 }
 
-boost::thread make_thread_return_lvalue()
+boost::thread make_thread_return_lvalue(boost::thread::id* the_id)
 {
- boost::thread t(do_nothing);
+ boost::thread t(do_nothing,the_id);
     return boost::move(t);
 }
 
 void test_move_from_function_return_lvalue()
 {
- boost::thread x=make_thread_return_lvalue();
+ boost::thread::id the_id;
+ boost::thread x=make_thread_return_lvalue(&the_id);
+ boost::thread::id x_id=x.get_id();
     x.join();
+ BOOST_CHECK_EQUAL(the_id,x_id);
 }
 
+void test_move_assign()
+{
+ boost::thread::id the_id;
+ boost::thread x(do_nothing,&the_id);
+ boost::thread y;
+ y=boost::move(x);
+ boost::thread::id y_id=y.get_id();
+ y.join();
+ BOOST_CHECK_EQUAL(the_id,y_id);
+}
 
 boost::unit_test_framework::test_suite* init_unit_test_suite(int, char*[])
 {
@@ -46,5 +67,6 @@
     test->add(BOOST_TEST_CASE(test_move_on_construction));
     test->add(BOOST_TEST_CASE(test_move_from_function_return));
     test->add(BOOST_TEST_CASE(test_move_from_function_return_lvalue));
+ test->add(BOOST_TEST_CASE(test_move_assign));
     return test;
 }


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