From f6ac57b4c97bf7ba88ab0a4a0732ca85287066af Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 20 Nov 2007 07:41:38 +0000 Subject: [PATCH] Merged revisions 41161-41246 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r41161 | bemandawes | 2007-11-16 15:21:47 -0800 (Fri, 16 Nov 2007) | 1 line Fix markup error ........ r41163 | bgubenko | 2007-11-16 17:28:10 -0800 (Fri, 16 Nov 2007) | 1 line mark some fusion library tests for acc toolset ........ r41164 | djowel | 2007-11-16 17:51:04 -0800 (Fri, 16 Nov 2007) | 1 line fix for trac ticket #1450 ........ r41165 | lbourdev | 2007-11-16 19:38:25 -0800 (Fri, 16 Nov 2007) | 10 lines Updated to version 2.1.2 Added support for more compilers. Added new flag GIL_NONWORD_POINTER_ALIGNMENT_SUPPORTED to indicate whether dereferencing on non-word boundary is supported. Enabling this flag improves performance. Fixed two bugs related to non-byte-aligned images. The image alignment parameter is now specified in bytes, and has a default of 0, which means "packed" alignment. In particular, for non-byte-aligned images alignment of 0 means there are no padding bits at the ends of rows. Added the allocator as an optional parameter to image constructors and image recreate methods. ........ r41167 | grafik | 2007-11-16 20:11:49 -0800 (Fri, 16 Nov 2007) | 1 line Add "--out-xml=xyz.xml" option that dumps the output of all actions, and the test.jam information, to the given file. Changes are mostly from Dave. ........ r41169 | johnmaddock | 2007-11-17 02:00:43 -0800 (Sat, 17 Nov 2007) | 1 line Ooops, check on wrong index, now fixed. ........ r41170 | johnmaddock | 2007-11-17 04:17:05 -0800 (Sat, 17 Nov 2007) | 1 line Fix WinCE issues. ........ r41172 | johnmaddock | 2007-11-17 10:41:29 -0800 (Sat, 17 Nov 2007) | 1 line Changed test to catch throw exceptions from thread creation. ........ r41173 | bemandawes | 2007-11-17 12:13:16 -0800 (Sat, 17 Nov 2007) | 1 line // Add or correct comment identifying Boost library this header is associated with. ........ r41174 | grafik | 2007-11-17 12:14:24 -0800 (Sat, 17 Nov 2007) | 1 line Add in Dave's comments, and expand information in XML output to include action names, sources, properties, bjam info, and platform info. This required one minor change to actions to keep track of the action object generating the targets. ........ r41175 | nesotto | 2007-11-17 12:22:05 -0800 (Sat, 17 Nov 2007) | 1 line minor update of comments ........ r41176 | nesotto | 2007-11-17 12:22:20 -0800 (Sat, 17 Nov 2007) | 1 line last updates ........ r41177 | nesotto | 2007-11-17 12:44:29 -0800 (Sat, 17 Nov 2007) | 1 line works after local test with vc8 ........ r41178 | nesotto | 2007-11-17 13:02:22 -0800 (Sat, 17 Nov 2007) | 1 line added missing header ........ r41180 | nesotto | 2007-11-17 13:19:13 -0800 (Sat, 17 Nov 2007) | 1 line iostream macro patch ........ r41181 | nesotto | 2007-11-17 13:21:53 -0800 (Sat, 17 Nov 2007) | 1 line removed some warnings ........ r41182 | grafik | 2007-11-17 13:22:40 -0800 (Sat, 17 Nov 2007) | 1 line Add working dir to build description, move jam version to an attribute. ........ r41183 | nesotto | 2007-11-17 13:24:16 -0800 (Sat, 17 Nov 2007) | 1 line macro patch ........ r41185 | nesotto | 2007-11-17 13:43:32 -0800 (Sat, 17 Nov 2007) | 1 line minor change to define the value type of the iterators better ........ r41186 | grafik | 2007-11-17 14:09:26 -0800 (Sat, 17 Nov 2007) | 1 line Change "actual" to the more natural "target", and change "target" to "path". Add bjam command and bb version to XML. ........ r41187 | bemandawes | 2007-11-17 14:48:06 -0800 (Sat, 17 Nov 2007) | 1 line Add or correct comment identifying Boost library this header is associated with. ........ r41188 | andreas_huber69 | 2007-11-17 16:08:46 -0800 (Sat, 17 Nov 2007) | 1 line Added markup for statechart failures on msvc-8.0~wm5~stlport5.1 ........ r41192 | grafik | 2007-11-17 22:42:14 -0800 (Sat, 17 Nov 2007) | 1 line Add to XML output the known targets and dependencies to allow creation of the full build dependency graph. Merge from Dave's Bitten branch. ........ r41193 | johnmaddock | 2007-11-18 02:07:14 -0800 (Sun, 18 Nov 2007) | 1 line Ooops: previous commit broke platforms/compilers with no long double support, added workaround as fix. ........ r41194 | igaztanaga | 2007-11-18 02:41:57 -0800 (Sun, 18 Nov 2007) | 1 line Interprocess changes to support systems with filesystem-based shared memory ........ r41195 | igaztanaga | 2007-11-18 02:43:35 -0800 (Sun, 18 Nov 2007) | 1 line Added scapegoat trees and an option to store the hash value in the hook for unordered containers ........ r41196 | igaztanaga | 2007-11-18 02:44:56 -0800 (Sun, 18 Nov 2007) | 1 line Added scapegoat trees and an option to store the hash value in the hook for unordered containers ........ r41197 | igaztanaga | 2007-11-18 02:51:19 -0800 (Sun, 18 Nov 2007) | 1 line Interprocess changes to support systems with filesystem-based shared memory ........ r41198 | igaztanaga | 2007-11-18 02:54:48 -0800 (Sun, 18 Nov 2007) | 1 line Interprocess changes to support systems with filesystem-based shared memory ........ r41199 | johnmaddock | 2007-11-18 04:23:37 -0800 (Sun, 18 Nov 2007) | 1 line Added missing template argument to specialisations. ........ r41200 | johnmaddock | 2007-11-18 04:24:42 -0800 (Sun, 18 Nov 2007) | 1 line Fix IMB xlc error limits, added workarounds where these were missed by the last commit. ........ r41201 | t_schwinger | 2007-11-18 06:06:47 -0800 (Sun, 18 Nov 2007) | 3 lines adds comment to fusion aCC failure markup ........ r41202 | danieljames | 2007-11-18 08:10:12 -0800 (Sun, 18 Nov 2007) | 2 lines Move the instructions for running regression tests to the new site. Fixes #1265. ........ r41210 | danieljames | 2007-11-18 12:18:04 -0800 (Sun, 18 Nov 2007) | 2 lines Move the 'implementation variations' page to the new site. Fixes #1355. ........ r41211 | eric_niebler | 2007-11-18 12:19:55 -0800 (Sun, 18 Nov 2007) | 1 line vc6 doesn't like BOOST_MPL_ASSERT_MSG ........ r41212 | grafik | 2007-11-18 12:24:25 -0800 (Sun, 18 Nov 2007) | 1 line Inspection report fixes. ........ r41213 | grafik | 2007-11-18 12:53:28 -0800 (Sun, 18 Nov 2007) | 1 line Cleanup tools/regression to remove obsolete runner scripts, move existing docs to doc subdir, and clean html docs into valid xhtml. ........ r41214 | grafik | 2007-11-18 13:02:51 -0800 (Sun, 18 Nov 2007) | 1 line Add missing include, for std::strchr function. ........ r41215 | grafik | 2007-11-18 13:07:26 -0800 (Sun, 18 Nov 2007) | 1 line Add keyword tags. ........ r41216 | niels_dekker | 2007-11-18 14:11:57 -0800 (Sun, 18 Nov 2007) | 1 line Code refactoring: removed private base classes of value_initialized, as suggested by Fernando Cacciola. ........ r41217 | djowel | 2007-11-18 16:05:43 -0800 (Sun, 18 Nov 2007) | 1 line added link to docs ........ r41218 | johnmaddock | 2007-11-19 02:02:16 -0800 (Mon, 19 Nov 2007) | 1 line Oops: added missing template specialisation argument. ........ r41219 | johnmaddock | 2007-11-19 02:20:36 -0800 (Mon, 19 Nov 2007) | 1 line No user32.lib on WinCE ........ r41220 | joaquin | 2007-11-19 03:08:11 -0800 (Mon, 19 Nov 2007) | 1 line moved some ADL stuff out of a potentially name-hiding scope ........ r41221 | troyer | 2007-11-19 04:15:58 -0800 (Mon, 19 Nov 2007) | 1 line made complex seriaqlization more portable ........ r41222 | anthonyw | 2007-11-19 04:17:31 -0800 (Mon, 19 Nov 2007) | 1 line fixed TSS cleanup on 64-bit Windows ........ r41223 | anthonyw | 2007-11-19 04:29:14 -0800 (Mon, 19 Nov 2007) | 1 line fixed problems with TSS cleanup when using LoadLibrary and when threads finish after thread_specific_ptr instance has been destroyed ........ r41224 | garcia | 2007-11-19 05:28:00 -0800 (Mon, 19 Nov 2007) | 2 lines A bunch of review volunteers. ........ r41225 | garcia | 2007-11-19 06:01:34 -0800 (Mon, 19 Nov 2007) | 2 lines Added boost.range update ........ r41226 | anthonyw | 2007-11-19 06:29:22 -0800 (Mon, 19 Nov 2007) | 1 line added copyright ........ r41227 | aaron_windsor | 2007-11-19 07:28:26 -0800 (Mon, 19 Nov 2007) | 1 line Cleaning up #includes to avoid errors on gcc 4.1 and above. ........ r41234 | igaztanaga | 2007-11-19 08:55:23 -0800 (Mon, 19 Nov 2007) | 1 line Fixed errors detected by gcc-4.3 ........ r41235 | hljin | 2007-11-19 09:26:12 -0800 (Mon, 19 Nov 2007) | 1 line GIL: updated the design guide based on the new changes ........ r41236 | grafik | 2007-11-19 09:44:31 -0800 (Mon, 19 Nov 2007) | 1 line Make quietly actions really quiet by not printing the command output. The output for the quietly actions is still available through "__ACTION_RULE__". ........ r41237 | grafik | 2007-11-19 10:02:43 -0800 (Mon, 19 Nov 2007) | 1 line Add architecture and instruction-set values for HP/PA-RISC. ........ r41238 | igaztanaga | 2007-11-19 10:09:13 -0800 (Mon, 19 Nov 2007) | 1 line Corrected ifdef ........ r41240 | igaztanaga | 2007-11-19 10:32:12 -0800 (Mon, 19 Nov 2007) | 1 line Fixed 64 bit std::size_t specialization error ........ r41241 | hljin | 2007-11-19 10:34:59 -0800 (Mon, 19 Nov 2007) | 1 line GIL: broke the main test into small tests ........ r41242 | bgubenko | 2007-11-19 11:25:21 -0800 (Mon, 19 Nov 2007) | 1 line add OSPLAT=PARISC for HP-UX PA-RISC ........ [SVN r41247] --- doc/boost_range.html | 24 +++++++++- doc/headers.html | 23 ++++------ doc/utility_class.html | 58 +++++++++++++----------- include/boost/range/begin.hpp | 5 ++ include/boost/range/concepts.hpp | 1 - include/boost/range/config.hpp | 3 +- include/boost/range/detail/microsoft.hpp | 4 -- include/boost/range/end.hpp | 5 ++ include/boost/range/iterator_range.hpp | 20 ++++---- test/iterator_pair.cpp | 6 +-- test/std_container.cpp | 4 +- 11 files changed, 91 insertions(+), 62 deletions(-) diff --git a/doc/boost_range.html b/doc/boost_range.html index 65284fa..ace1901 100644 --- a/doc/boost_range.html +++ b/doc/boost_range.html @@ -157,7 +157,7 @@ class=identifier>T& template< class T > - typename range_size<T>::type + typename range_difference<T>::type size( const T& r ); // @@ -471,12 +471,34 @@ class=identifier>T& linear time for pointers to a string, constant time otherwise + + + as_array(x) + iterator_range<X> + + [boost::begin(x),boost::end(x)) + + + + + + constant time otherwise + +

The special const_-named functions are useful when you want to document clearly that your code is read-only.

+

+ as_literal() can be used internally in string + algorithm librararies to such that arrays of characters are + handled correctly. +

+

+ as_array() can be used with string algorithm libraries to make it clear that arrays of characters are handled like an array and not like a string. +

Notice that the above functions should always be called with qualification (boost::) to prevent unintended Argument Dependent Lookup (ADL). diff --git a/doc/headers.html b/doc/headers.html index 1539ae8..69987ce 100755 --- a/doc/headers.html +++ b/doc/headers.html @@ -50,7 +50,7 @@ >range_iterator Single Pass Range - + <boost/range/mutable_iterator.hpp> range_mutable_iterator @@ -69,20 +69,15 @@ Forward Range - <boost/range/size_type.hpp> - range_size - Forward Range - - <boost/range/pointer.hpp> range_pointer + >range_pointer - - + <boost/range/category.hpp> range_category + >range_category - @@ -112,7 +107,7 @@ empty Single Pass Range - + <boost/range/distance.hpp> distance Forward Range @@ -121,7 +116,7 @@ <boost/range/size.hpp> size Random Access Range - + <boost/range/rbegin.hpp> @@ -139,14 +134,14 @@ Bidirectional Range - + <boost/range/as_array.hpp> as_array - - + <boost/range/as_literal.hpp> as_literal @@ -178,7 +173,7 @@


- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2007


diff --git a/doc/utility_class.html b/doc/utility_class.html index 16df096..f7b5535 100644 --- a/doc/utility_class.html +++ b/doc/utility_class.html @@ -79,9 +79,10 @@ corresponding const_iterator is.

class iterator_range { public: // Forward Range types - typedef ForwardTraversalIterator iterator; - typedef ForwardTraversalIterator const_iterator; - + typedef ForwardTraversalIterator iterator; + typedef ForwardTraversalIterator const_iterator; + typedef iterator_difference<iterator>::type difference_type; +
public: // construction, assignment template< class ForwardTraversalIterator2 > iterator_range( ForwardTraversalIterator2 Begin, ForwardTraversalIterator2 End ); @@ -99,23 +100,24 @@ corresponding const_iterator is.

iterator_range& operator=( const ForwardRange& r ); public: // Forward Range functions - iterator begin() const; - iterator end() const; - size_type size() const; - bool empty() const; + iterator begin() const; + iterator end() const; + difference_type size() const; + bool empty() const; public: // convenience - operator unspecified_bool_type() const; - bool operator unspecified_bool_type() const; + bool equal( const iterator_range& ) ( const iterator_range& ) const; - referencefront() const; - reference back() const; + reference front() const; + reference back() const; + iterator_range& advance_begin( difference_type n ); + iterator_range& advance_end( difference_type n ); // for Random Access Range only: - value_type& operator[]( size_type at ) const; - value_typecial>& operator()( size_type at ) const; + reference operator[]( difference_type at ) const; + value_type operator()( difference_type at ) const; }; // stream output @@ -168,11 +170,11 @@ class=keyword>const; ForwardTraversalIterator End ); template< class ForwardRange > - iterator_range< typename iterator<ForwardRange>::type > + iterator_range< typename range_iterator<ForwardRange>::type > make_iterator_range( ForwardRange& r ); template< class ForwardRange > - iterator_range< typename const_iterator<ForwardRange>::type > + iterator_range< typename range_iterator<const ForwardRange>::type > make_iterator_range( const ForwardRange& r ); template< class Range > @@ -182,7 +184,7 @@ class=keyword>const; typename range_difference<Range>::type advance_end ); template< class Range > - iterator_range< typename range_const_iterator<Range>::type > + iterator_range< typename range_iterator<const Range>::type > make_iterator_range( const Range& r, typename range_difference<Range>::type advance_begin, typename range_difference<Range>::type advance_end ); @@ -286,12 +288,14 @@ class can propagate constness since it knows what a corresponding namespace boost { template< class ForwardRange > - class sub_range : public iterator_range< typename range_result_iterator<ForwardRange>::type > + class sub_range : public iterator_range< typename range_iterator<ForwardRange>::type > { public: - typedef typename range_result_iterator<ForwardRange>::type iterator; - typedef typename range_const_iterator<ForwardRange>::type const_iterator; + typedef typename range_iterator<ForwardRange>::type iterator; + typedef typename range_iterator<const ForwardRange>::type const_iterator; + typedef typename iterator_difference<iterator>::type difference_type; + public: // construction, assignment template< class ForwardTraversalIterator > sub_range( ForwardTraversalIterator Begin, ForwardTraversalIterator End ); @@ -320,8 +324,8 @@ class can propagate constness since it knows what a corresponding value_type& back(); const value_type& back() const; // for Random Access Range only: - value_type& operator[]( size_type at ); - const value_type& operator[]( size_type at ) const; + value_type& operator[]( difference_type at ); + const value_type& operator[]( difference_type at ) const; public: // rest of interface inherited from iterator_range @@ -339,15 +343,15 @@ store the result from this algorithm. Here is an example of how we can do it with and without sub_range
-    std::string str("hello");
-    iterator_range<std::string::iterator> ir = find_first( str, "ll" );
-    sub_range<std::string>               sub = find_first( str, "ll" );
+    std::string str("hello");
+    iterator_range<std::string::iterator> ir = find_first( str, as_literal("ll") );
+    sub_range<std::string>               sub = find_first( str, as_literal("ll") );
 


- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2007


diff --git a/include/boost/range/begin.hpp b/include/boost/range/begin.hpp index e8251c9..9abf313 100755 --- a/include/boost/range/begin.hpp +++ b/include/boost/range/begin.hpp @@ -41,6 +41,11 @@ namespace range_detail inline BOOST_DEDUCED_TYPENAME range_iterator::type range_begin( C& c ) { + // + // If you get a compile-error here, it is most likely because + // you have not implemented range_begin() properly in + // the namespace of C + // return c.begin(); } diff --git a/include/boost/range/concepts.hpp b/include/boost/range/concepts.hpp index d9c122f..53a88dc 100755 --- a/include/boost/range/concepts.hpp +++ b/include/boost/range/concepts.hpp @@ -82,7 +82,6 @@ namespace boost { T a; range_iterator i; range_const_iterator ci; - bool b; }; //! Check if a type T models the ForwardRange range concept. diff --git a/include/boost/range/config.hpp b/include/boost/range/config.hpp index 5f856bb..4e7fb24 100755 --- a/include/boost/range/config.hpp +++ b/include/boost/range/config.hpp @@ -37,8 +37,7 @@ #error "macro already defined!" #endif -//#if BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) || __MWERKS__ <= 0x3003 -#if _MSC_VER <= 1300 && !defined( __COMO__ ) && !defined( __GNUC__ ) && __MWERKS__ <= 0x3003 +#if BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) || BOOST_WORKAROUND( __MWERKS__, <= 0x3003 ) #define BOOST_RANGE_NO_ARRAY_SUPPORT 1 #endif diff --git a/include/boost/range/detail/microsoft.hpp b/include/boost/range/detail/microsoft.hpp index 2c4b1ed..7b672c9 100644 --- a/include/boost/range/detail/microsoft.hpp +++ b/include/boost/range/detail/microsoft.hpp @@ -1,9 +1,6 @@ #ifndef BOOST_RANGE_DETAIL_MICROSOFT_HPP #define BOOST_RANGE_DETAIL_MICROSOFT_HPP - - - // Boost.Range MFC/ATL Extension // // Copyright Shunsuke Sogame 2005-2006. @@ -931,5 +928,4 @@ namespace boost { namespace range_detail_microsoft { - #endif diff --git a/include/boost/range/end.hpp b/include/boost/range/end.hpp index be2f495..b777a55 100755 --- a/include/boost/range/end.hpp +++ b/include/boost/range/end.hpp @@ -42,6 +42,11 @@ namespace range_detail inline BOOST_DEDUCED_TYPENAME range_iterator::type range_end( C& c ) { + // + // If you get a compile-error here, it is most likely because + // you have not implemented range_begin() properly in + // the namespace of C + // return c.end(); } diff --git a/include/boost/range/iterator_range.hpp b/include/boost/range/iterator_range.hpp index 9df24c0..4304ecc 100755 --- a/include/boost/range/iterator_range.hpp +++ b/include/boost/range/iterator_range.hpp @@ -29,11 +29,13 @@ #include #include #include -#ifndef BOOST_OLD_IOSTREAMS -# include -#else -# include -#endif +#ifndef _STLP_NO_IOSTREAMS +# ifndef BOOST_OLD_IOSTREAMS +# include +# else +# include +# endif +#endif // _STLP_NO_IOSTREAMS #include #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) @@ -396,7 +398,8 @@ namespace boost // iterator range free-standing operators ---------------------------// -#ifndef BOOST_OLD_IOSTREAMS +#ifndef _STLP_NO_IOSTREAMS +# ifndef BOOST_OLD_IOSTREAMS //! iterator_range output operator /*! @@ -415,7 +418,7 @@ namespace boost return Os; } -#else +# else //! iterator_range output operator /*! @@ -431,7 +434,8 @@ namespace boost return Os; } -#endif +# endif +#endif // _STLP_NO_IOSTREAMS ///////////////////////////////////////////////////////////////////// // comparison operators diff --git a/test/iterator_pair.cpp b/test/iterator_pair.cpp index d50a1f7..2546817 100755 --- a/test/iterator_pair.cpp +++ b/test/iterator_pair.cpp @@ -65,17 +65,17 @@ void check_iterator_pair() BOOST_CHECK( begin( pair ) == pair.first ); BOOST_CHECK( end( pair ) == pair.second ); BOOST_CHECK( empty( pair ) == (pair.first == pair.second) ); - BOOST_CHECK( size( pair ) == std::size_t( std::distance( pair.first, pair.second ) ) ); + BOOST_CHECK( size( pair ) == std::distance( pair.first, pair.second ) ); BOOST_CHECK( begin( const_pair ) == const_pair.first ); BOOST_CHECK( end( const_pair ) == const_pair.second ); BOOST_CHECK( empty( const_pair ) == (const_pair.first == const_pair.second) ); - BOOST_CHECK( size( const_pair ) == std::size_t( std::distance( const_pair.first, const_pair.second ) ) ); + BOOST_CHECK( size( const_pair ) == std::distance( const_pair.first, const_pair.second ) ); BOOST_CHECK( begin( constness_pair ) == constness_pair.first ); BOOST_CHECK( end( constness_pair ) == constness_pair.second ); BOOST_CHECK( empty( constness_pair ) == (constness_pair.first == const_pair.second) ); - BOOST_CHECK( size( constness_pair ) == std::size_t( std::distance( constness_pair.first, constness_pair.second ) ) ); + BOOST_CHECK( size( constness_pair ) == std::distance( constness_pair.first, constness_pair.second ) ); } diff --git a/test/std_container.cpp b/test/std_container.cpp index e26d2a3..e2ee692 100755 --- a/test/std_container.cpp +++ b/test/std_container.cpp @@ -48,12 +48,12 @@ void check_std_container() BOOST_CHECK( begin( vec ) == vec.begin() ); BOOST_CHECK( end( vec ) == vec.end() ); BOOST_CHECK( empty( vec ) == vec.empty() ); - BOOST_CHECK( size( vec ) == vec.size() ); + BOOST_CHECK( (std::size_t)size( vec ) == vec.size() ); BOOST_CHECK( begin( cvec ) == cvec.begin() ); BOOST_CHECK( end( cvec ) == cvec.end() ); BOOST_CHECK( empty( cvec ) == cvec.empty() ); - BOOST_CHECK( size( cvec ) == cvec.size() ); + BOOST_CHECK( (std::size_t)size( cvec ) == cvec.size() ); }