Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-08-05 11:39:46


Author: eric_niebler
Date: 2008-08-05 11:39:45 EDT (Tue, 05 Aug 2008)
New Revision: 47991
URL: http://svn.boost.org/trac/boost/changeset/47991

Log:
merged from trunk
Added:
   branches/proto/v4/boost/tr1/tr1/unordered_map
      - copied unchanged from r47990, /trunk/boost/tr1/tr1/unordered_map
   branches/proto/v4/boost/tr1/tr1/unordered_set
      - copied unchanged from r47990, /trunk/boost/tr1/tr1/unordered_set
   branches/proto/v4/boost/tr1/unordered_map.hpp
      - copied unchanged from r47990, /trunk/boost/tr1/unordered_map.hpp
   branches/proto/v4/boost/tr1/unordered_set.hpp
      - copied unchanged from r47990, /trunk/boost/tr1/unordered_set.hpp
   branches/proto/v4/libs/tr1/test/cyclic_depend/unordered_map.cpp
      - copied unchanged from r47990, /trunk/libs/tr1/test/cyclic_depend/unordered_map.cpp
   branches/proto/v4/libs/tr1/test/cyclic_depend/unordered_set.cpp
      - copied unchanged from r47990, /trunk/libs/tr1/test/cyclic_depend/unordered_set.cpp
   branches/proto/v4/libs/tr1/test/test_unordered_map.cpp
      - copied unchanged from r47990, /trunk/libs/tr1/test/test_unordered_map.cpp
   branches/proto/v4/libs/tr1/test/test_unordered_set.cpp
      - copied unchanged from r47990, /trunk/libs/tr1/test/test_unordered_set.cpp
   branches/proto/v4/libs/tr1/test/unordered_concepts.hpp
      - copied unchanged from r47990, /trunk/libs/tr1/test/unordered_concepts.hpp
Properties modified:
   branches/proto/v4/ (props changed)
Text files modified:
   branches/proto/v4/boost/numeric/interval/arith2.hpp | 2
   branches/proto/v4/boost/numeric/interval/utility.hpp | 4
   branches/proto/v4/libs/numeric/interval/doc/interval.htm | 2
   branches/proto/v4/libs/numeric/interval/examples/newton-raphson.cpp | 15 +
   branches/proto/v4/libs/test/test/basic_cstring_test.cpp | 23 ++-
   branches/proto/v4/libs/tr1/doc/tr1.qbk | 226 ++++++++++++++++++++++-----------------
   6 files changed, 153 insertions(+), 119 deletions(-)

Modified: branches/proto/v4/boost/numeric/interval/arith2.hpp
==============================================================================
--- branches/proto/v4/boost/numeric/interval/arith2.hpp (original)
+++ branches/proto/v4/boost/numeric/interval/arith2.hpp 2008-08-05 11:39:45 EDT (Tue, 05 Aug 2008)
@@ -185,7 +185,7 @@
       return I(yl, yu, true);
   } else if (interval_lib::user::is_neg(x.lower())) { // [-1,1]
     if (pwr & 1) { // [-1,1]^1
- return I(-pow_up(-x.lower(), pwr, rnd), pow_up(x.upper(), pwr, rnd), true);
+ return I(-pow_up(static_cast<T>(-x.lower()), pwr, rnd), pow_up(x.upper(), pwr, rnd), true);
     } else { // [-1,1]^2
       return I(static_cast<T>(0), pow_up(max BOOST_PREVENT_MACRO_SUBSTITUTION(static_cast<T>(-x.lower()), x.upper()), pwr, rnd), true);
     }

Modified: branches/proto/v4/boost/numeric/interval/utility.hpp
==============================================================================
--- branches/proto/v4/boost/numeric/interval/utility.hpp (original)
+++ branches/proto/v4/boost/numeric/interval/utility.hpp 2008-08-05 11:39:45 EDT (Tue, 05 Aug 2008)
@@ -144,8 +144,8 @@
              const interval<T, Policies2>& y)
 {
   if (interval_lib::detail::test_input(x, y)) return false;
- return x.lower() <= y.lower() && y.lower() <= x.upper() ||
- y.lower() <= x.lower() && x.lower() <= y.upper();
+ return (x.lower() <= y.lower() && y.lower() <= x.upper()) ||
+ (y.lower() <= x.lower() && x.lower() <= y.upper());
 }
 
 template<class T, class Policies> inline

Modified: branches/proto/v4/libs/numeric/interval/doc/interval.htm
==============================================================================
--- branches/proto/v4/libs/numeric/interval/doc/interval.htm (original)
+++ branches/proto/v4/libs/numeric/interval/doc/interval.htm 2008-08-05 11:39:45 EDT (Tue, 05 Aug 2008)
@@ -214,7 +214,7 @@
 
   <p>This library provides two quite distinct levels of usage. One is to use
   the basic class template <code>interval&lt;T&gt;</code> without specifying
- the policy. This only requires to know and understand the concepts
+ the policy. This only requires one to know and understand the concepts
   developed above and the content of the namespace boost. In addition to the
   class <code>interval&lt;T&gt;</code>, this level of usage provides
   arithmetic operators (<code>+</code>, <code>-</code>, <code>*</code>,

Modified: branches/proto/v4/libs/numeric/interval/examples/newton-raphson.cpp
==============================================================================
--- branches/proto/v4/libs/numeric/interval/examples/newton-raphson.cpp (original)
+++ branches/proto/v4/libs/numeric/interval/examples/newton-raphson.cpp 2008-08-05 11:39:45 EDT (Tue, 05 Aug 2008)
@@ -53,13 +53,15 @@
     if (overlap(x1, x)) x1 = intersect(x, x1);
     else if (x2_used) { x1 = x2; x2_used = false; }
     else continue;
- if (x2_used)
+ if (x2_used) {
       if (overlap(x2, x)) x2 = intersect(x, x2);
       else x2_used = false;
+ }
     if (x2_used && width(x2) > width(x1)) std::swap(x1, x2);
- if (!zero_in(f(x1)))
+ if (!zero_in(f(x1))) {
       if (x2_used) { x1 = x2; x2_used = false; }
       else continue;
+ }
     if (width(x1) < max_width) res.push_back(x1);
     else if (width(x1) > alpha * width(x)) {
       std::pair<I1, I1> p = bisect(x);
@@ -67,9 +69,10 @@
       x2 = p.second;
       x2_used = true;
     } else l.push_back(x1);
- if (x2_used && zero_in(f(x2)))
+ if (x2_used && zero_in(f(x2))) {
       if (width(x2) < max_width) res.push_back(x2);
       else l.push_back(x2);
+ }
   }
   return res;
 }
@@ -98,18 +101,20 @@
       x2 = intersect(x, xx - division_part2(vf, vd, x2_used));
     }
     if (width(x2) > width(x1)) std::swap(x1, x2);
- if (empty(x1) || !zero_in(f(x1)))
+ if (empty(x1) || !zero_in(f(x1))) {
       if (!empty(x2)) { x1 = x2; x2 = I2::empty(); }
       else continue;
+ }
     if (width(x1) < max_width) res.push_back(x1);
     else if (width(x1) > alpha * width(x)) {
       std::pair<I2, I2> p = bisect(x);
       if (zero_in(f(p.first))) l.push_back(p.first);
       x2 = p.second;
     } else l.push_back(x1);
- if (!empty(x2) && zero_in(f(x2)))
+ if (!empty(x2) && zero_in(f(x2))) {
       if (width(x2) < max_width) res.push_back(x2);
       else l.push_back(x2);
+ }
   }
   return res;
 }

Modified: branches/proto/v4/libs/test/test/basic_cstring_test.cpp
==============================================================================
--- branches/proto/v4/libs/test/test/basic_cstring_test.cpp (original)
+++ branches/proto/v4/libs/test/test/basic_cstring_test.cpp 2008-08-05 11:39:45 EDT (Tue, 05 Aug 2008)
@@ -404,28 +404,29 @@
 
 BOOST_TEST_CASE_TEMPLATE_FUNCTION( find_test, CharT )
 {
+ typedef typename utf::basic_cstring<CharT>::size_type size;
     utf::basic_cstring<CharT> bcs1( TEST_STRING );
 
- utf::basic_cstring<CharT>::size_type not_found = (utf::basic_cstring<CharT>::size_type)utf::basic_cstring<CharT>::npos;
+ size not_found = (size)utf::basic_cstring<CharT>::npos;
 
     BOOST_CHECK_EQUAL( bcs1.find( utf::basic_cstring<CharT>() ), not_found );
- BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "test" ) ), (utf::basic_cstring<CharT>::size_type)0 );
- BOOST_CHECK_EQUAL( bcs1.find( TEST_STRING ), (utf::basic_cstring<CharT>::size_type)0 );
+ BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "test" ) ), (size)0 );
+ BOOST_CHECK_EQUAL( bcs1.find( TEST_STRING ), (size)0 );
     BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "test_string " ) ), not_found );
     BOOST_CHECK_EQUAL( bcs1.find( LITERAL( " test_string" ) ), not_found );
- BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "est" ) ), (utf::basic_cstring<CharT>::size_type)1 );
- BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "t_st" ) ), (utf::basic_cstring<CharT>::size_type)3 );
- BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "ing" ) ), (utf::basic_cstring<CharT>::size_type)8 );
+ BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "est" ) ), (size)1 );
+ BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "t_st" ) ), (size)3 );
+ BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "ing" ) ), (size)8 );
     BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "tst" ) ), not_found );
 
     BOOST_CHECK_EQUAL( bcs1.rfind( utf::basic_cstring<CharT>() ), not_found );
- BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "test" ) ), (utf::basic_cstring<CharT>::size_type)0 );
- BOOST_CHECK_EQUAL( bcs1.rfind( TEST_STRING ), (utf::basic_cstring<CharT>::size_type)0 );
+ BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "test" ) ), (size)0 );
+ BOOST_CHECK_EQUAL( bcs1.rfind( TEST_STRING ), (size)0 );
     BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "test_string " ) ), not_found );
     BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( " test_string" ) ), not_found );
- BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "est" ) ), (utf::basic_cstring<CharT>::size_type)1 );
- BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "t_st" ) ), (utf::basic_cstring<CharT>::size_type)3 );
- BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "ing" ) ), (utf::basic_cstring<CharT>::size_type)8 );
+ BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "est" ) ), (size)1 );
+ BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "t_st" ) ), (size)3 );
+ BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "ing" ) ), (size)8 );
     BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "tst" ) ), not_found );
 }
 

Modified: branches/proto/v4/libs/tr1/doc/tr1.qbk
==============================================================================
--- branches/proto/v4/libs/tr1/doc/tr1.qbk (original)
+++ branches/proto/v4/libs/tr1/doc/tr1.qbk 2008-08-05 11:39:45 EDT (Tue, 05 Aug 2008)
@@ -1337,6 +1337,133 @@
 
 [endsect]
 
+[section:unordered_set Unordered Associative Set (Hash Table).]
+
+ #include <boost/tr1/unordered_set.hpp>
+
+or
+
+ #include <unordered_set>
+
+For accessing data based on key lookup, the C++ standard library
+offers std::set, std::map, std::multiset and std::multimap.
+These are generally implemented using balanced binary trees so that
+lookup time has logarithmic complexity. That is generally okay,
+but in many cases a hash table can perform better, as accessing
+data has constant complexity, on average. The worst case complexity
+is linear, but that occurs rarely and with some care, can be avoided.
+
+With this in mind, the C++ Standard Library Technical Report
+introduced the unordered associative containers, which are
+implemented using hash tables, and they have now been added to
+the Working Draft of the C++ Standard.
+
+Refer to the
+[@../../libs/unordered/index.html Unordered Library docs]
+for more information.
+
+ namespace std {
+ namespace tr1 {
+
+ template <class Value,
+ class Hash = hash<Value>,
+ class Pred = std::equal_to<Value>,
+ class Alloc = std::allocator<Value> >
+ class unordered_set;
+
+ // [6.3.4.5] Class template unordered_multiset
+ template <class Value,
+ class Hash = hash<Value>,
+ class Pred = std::equal_to<Value>,
+ class Alloc = std::allocator<Value> >
+ class unordered_multiset;
+
+ template <class Value, class Hash, class Pred, class Alloc>
+ void swap(unordered_set<Value, Hash, Pred, Alloc>& x,
+ unordered_set<Value, Hash, Pred, Alloc>& y);
+
+ template <class Value, class Hash, class Pred, class Alloc>
+ void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,
+ unordered_multiset<Value, Hash, Pred, Alloc>& y);
+
+ } // namespace tr1
+ } // namespace std
+
+[*Configuration:]
+[@../../libs/config/index.html Boost.Config] should (automatically) define
+the macro BOOST_HAS_TR1_UNORDERED_SET if your
+standard library implements this part of TR1.
+
+[*Standard Conformity:]
+No known issues for conforming compilers.
+
+[endsect]
+
+[section:unordered_map Unordered Associative Map (Hash Table).]
+
+ #include <boost/tr1/unordered_map.hpp>
+
+or
+
+ #include <unordered_map>
+
+For accessing data based on key lookup, the C++ standard library
+offers std::set, std::map, std::multiset and std::multimap.
+These are generally implemented using balanced binary trees so that
+lookup time has logarithmic complexity. That is generally okay,
+but in many cases a hash table can perform better, as accessing
+data has constant complexity, on average. The worst case complexity
+is linear, but that occurs rarely and with some care, can be avoided.
+
+With this in mind, the C++ Standard Library Technical Report
+introduced the unordered associative containers, which are
+implemented using hash tables, and they have now been added to
+the Working Draft of the C++ Standard.
+
+Refer to the
+[@../../libs/unordered/index.html Unordered Library docs]
+for more information.
+
+ namespace std {
+ namespace tr1 {
+
+ // [6.3.4.4] Class template unordered_map
+ template <class Key,
+ class T,
+ class Hash = hash<Key>,
+ class Pred = std::equal_to<Key>,
+ class Alloc = std::allocator<std::pair<const Key, T> > >
+ class unordered_map;
+
+ // [6.3.4.6] Class template unordered_multimap
+ template <class Key,
+ class T,
+ class Hash = hash<Key>,
+ class Pred = std::equal_to<Key>,
+ class Alloc = std::allocator<std::pair<const Key, T> > >
+ class unordered_multimap;
+
+ template <class Key, class T, class Hash, class Pred, class Alloc>
+ void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
+ unordered_map<Key, T, Hash, Pred, Alloc>& y);
+
+ template <class Key, class T, class Hash, class Pred, class Alloc>
+ void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
+ unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
+
+ } // namespace tr1
+ } // namespace std
+
+[*Configuration:]
+[@../../libs/config/index.html Boost.Config] should (automatically) define
+the macro BOOST_HAS_TR1_UNORDERED_MAP if your
+standard library implements this part of TR1.
+
+[*Standard Conformity:]
+No known issues for conforming compilers.
+
+[endsect]
+
 [endsect]
 
 [section:unsupported TR By Subject: Unsupported Features]
@@ -1477,105 +1604,6 @@
 
 [endsect]
 
-[section:unordered_set Unordered Associative Set (Hash Table).]
-
- #include <boost/tr1/unordered_set.hpp>
-
-or
-
- #include <unordered_set>
-
-This is not currently supported by Boost, although that situation is
-hoped to change soon.
-
- namespace std {
- namespace tr1 {
-
- template <class Value,
- class Hash = hash<Value>,
- class Pred = std::equal_to<Value>,
- class Alloc = std::allocator<Value> >
- class unordered_set;
-
- // [6.3.4.5] Class template unordered_multiset
- template <class Value,
- class Hash = hash<Value>,
- class Pred = std::equal_to<Value>,
- class Alloc = std::allocator<Value> >
- class unordered_multiset;
-
- template <class Value, class Hash, class Pred, class Alloc>
- void swap(unordered_set<Value, Hash, Pred, Alloc>& x,
- unordered_set<Value, Hash, Pred, Alloc>& y);
-
- template <class Value, class Hash, class Pred, class Alloc>
- void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,
- unordered_multiset<Value, Hash, Pred, Alloc>& y);
-
- } // namespace tr1
- } // namespace std
-
-[*Configuration:]
-[@../../libs/config/index.html Boost.Config] should (automatically) define
-the macro BOOST_HAS_TR1_UNORDERED_SET if your
-standard library implements this part of TR1.
-
-[*Standard Conformity:]
-Not supported.
-
-[endsect]
-
-[section:unordered_map Unordered Associative Map (Hash Table).]
-
- #include <boost/tr1/unordered_map.hpp>
-
-or
-
- #include <unordered_map>
-
-This is not currently supported by Boost, although that situation is
-hoped to change soon.
-
- namespace std {
- namespace tr1 {
-
- // [6.3.4.4] Class template unordered_map
- template <class Key,
- class T,
- class Hash = hash<Key>,
- class Pred = std::equal_to<Key>,
- class Alloc = std::allocator<std::pair<const Key, T> > >
- class unordered_map;
-
- // [6.3.4.6] Class template unordered_multimap
- template <class Key,
- class T,
- class Hash = hash<Key>,
- class Pred = std::equal_to<Key>,
- class Alloc = std::allocator<std::pair<const Key, T> > >
- class unordered_multimap;
-
- template <class Key, class T, class Hash, class Pred, class Alloc>
- void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
- unordered_map<Key, T, Hash, Pred, Alloc>& y);
-
- template <class Key, class T, class Hash, class Pred, class Alloc>
- void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
- unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
-
- } // namespace tr1
- } // namespace std
-
-[*Configuration:]
-[@../../libs/config/index.html Boost.Config] should (automatically) define
-the macro BOOST_HAS_TR1_UNORDERED_MAP if your
-standard library implements this part of TR1.
-
-[*Standard Conformity:]
-Not supported.
-
-[endsect]
-
 [endsect]
 
 [section:header_list TR1 By Header]


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