From 6a455033ee9f5faa724e22e8d65c0cdfce695d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Tue, 29 Jun 2004 02:50:07 +0000 Subject: [PATCH] *** empty log message *** [SVN r23240] --- .gitattributes | 96 ++++++ include/boost/range.hpp | 23 ++ include/boost/range/begin.hpp | 115 +++++++ include/boost/range/config.hpp | 48 +++ include/boost/range/const_iterator.hpp | 103 ++++++ .../boost/range/const_reverse_iterator.hpp | 37 +++ include/boost/range/detail/begin.hpp | 120 +++++++ include/boost/range/detail/common.hpp | 117 +++++++ include/boost/range/detail/const_iterator.hpp | 102 ++++++ .../boost/range/detail/difference_type.hpp | 111 +++++++ include/boost/range/detail/empty.hpp | 120 +++++++ include/boost/range/detail/end.hpp | 141 ++++++++ .../range/detail/implementation_help.hpp | 161 ++++++++++ include/boost/range/detail/iterator.hpp | 101 ++++++ include/boost/range/detail/sfinae.hpp | 77 +++++ include/boost/range/detail/size.hpp | 142 +++++++++ include/boost/range/detail/size_type.hpp | 109 +++++++ include/boost/range/detail/sizer.hpp | 37 +++ include/boost/range/detail/value_type.hpp | 104 ++++++ include/boost/range/difference_type.hpp | 107 +++++++ include/boost/range/empty.hpp | 62 ++++ include/boost/range/end.hpp | 115 +++++++ include/boost/range/functions.hpp | 25 ++ include/boost/range/iterator.hpp | 105 ++++++ include/boost/range/iterator_range.hpp | 300 ++++++++++++++++++ include/boost/range/rbegin.hpp | 41 +++ include/boost/range/rend.hpp | 41 +++ include/boost/range/result_iterator.hpp | 43 +++ include/boost/range/reverse_iterator.hpp | 40 +++ .../boost/range/reverse_result_iterator.hpp | 39 +++ include/boost/range/size.hpp | 92 ++++++ include/boost/range/size_type.hpp | 103 ++++++ include/boost/range/sub_range.hpp | 126 ++++++++ include/boost/range/types.hpp | 28 ++ include/boost/range/value_type.hpp | 108 +++++++ 35 files changed, 3239 insertions(+) create mode 100644 .gitattributes create mode 100755 include/boost/range.hpp create mode 100755 include/boost/range/begin.hpp create mode 100755 include/boost/range/config.hpp create mode 100755 include/boost/range/const_iterator.hpp create mode 100755 include/boost/range/const_reverse_iterator.hpp create mode 100755 include/boost/range/detail/begin.hpp create mode 100755 include/boost/range/detail/common.hpp create mode 100755 include/boost/range/detail/const_iterator.hpp create mode 100755 include/boost/range/detail/difference_type.hpp create mode 100755 include/boost/range/detail/empty.hpp create mode 100755 include/boost/range/detail/end.hpp create mode 100755 include/boost/range/detail/implementation_help.hpp create mode 100755 include/boost/range/detail/iterator.hpp create mode 100755 include/boost/range/detail/sfinae.hpp create mode 100755 include/boost/range/detail/size.hpp create mode 100755 include/boost/range/detail/size_type.hpp create mode 100755 include/boost/range/detail/sizer.hpp create mode 100755 include/boost/range/detail/value_type.hpp create mode 100755 include/boost/range/difference_type.hpp create mode 100755 include/boost/range/empty.hpp create mode 100755 include/boost/range/end.hpp create mode 100755 include/boost/range/functions.hpp create mode 100755 include/boost/range/iterator.hpp create mode 100755 include/boost/range/iterator_range.hpp create mode 100755 include/boost/range/rbegin.hpp create mode 100755 include/boost/range/rend.hpp create mode 100755 include/boost/range/result_iterator.hpp create mode 100755 include/boost/range/reverse_iterator.hpp create mode 100755 include/boost/range/reverse_result_iterator.hpp create mode 100755 include/boost/range/size.hpp create mode 100755 include/boost/range/size_type.hpp create mode 100755 include/boost/range/sub_range.hpp create mode 100755 include/boost/range/types.hpp create mode 100755 include/boost/range/value_type.hpp diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3e84d7c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,96 @@ +* text=auto !eol svneol=native#text/plain +*.gitattributes text svneol=native#text/plain + +# Scriptish formats +*.bat text svneol=native#text/plain +*.bsh text svneol=native#text/x-beanshell +*.cgi text svneol=native#text/plain +*.cmd text svneol=native#text/plain +*.js text svneol=native#text/javascript +*.php text svneol=native#text/x-php +*.pl text svneol=native#text/x-perl +*.pm text svneol=native#text/x-perl +*.py text svneol=native#text/x-python +*.sh eol=lf svneol=LF#text/x-sh +configure eol=lf svneol=LF#text/x-sh + +# Image formats +*.bmp binary svneol=unset#image/bmp +*.gif binary svneol=unset#image/gif +*.ico binary svneol=unset#image/ico +*.jpeg binary svneol=unset#image/jpeg +*.jpg binary svneol=unset#image/jpeg +*.png binary svneol=unset#image/png +*.tif binary svneol=unset#image/tiff +*.tiff binary svneol=unset#image/tiff +*.svg text svneol=native#image/svg%2Bxml + +# Data formats +*.pdf binary svneol=unset#application/pdf +*.avi binary svneol=unset#video/avi +*.doc binary svneol=unset#application/msword +*.dsp text svneol=crlf#text/plain +*.dsw text svneol=crlf#text/plain +*.eps binary svneol=unset#application/postscript +*.gz binary svneol=unset#application/gzip +*.mov binary svneol=unset#video/quicktime +*.mp3 binary svneol=unset#audio/mpeg +*.ppt binary svneol=unset#application/vnd.ms-powerpoint +*.ps binary svneol=unset#application/postscript +*.psd binary svneol=unset#application/photoshop +*.rdf binary svneol=unset#text/rdf +*.rss text svneol=unset#text/xml +*.rtf binary svneol=unset#text/rtf +*.sln text svneol=native#text/plain +*.swf binary svneol=unset#application/x-shockwave-flash +*.tgz binary svneol=unset#application/gzip +*.vcproj text svneol=native#text/xml +*.vcxproj text svneol=native#text/xml +*.vsprops text svneol=native#text/xml +*.wav binary svneol=unset#audio/wav +*.xls binary svneol=unset#application/vnd.ms-excel +*.zip binary svneol=unset#application/zip + +# Text formats +.htaccess text svneol=native#text/plain +*.bbk text svneol=native#text/xml +*.cmake text svneol=native#text/plain +*.css text svneol=native#text/css +*.dtd text svneol=native#text/xml +*.htm text svneol=native#text/html +*.html text svneol=native#text/html +*.ini text svneol=native#text/plain +*.log text svneol=native#text/plain +*.mak text svneol=native#text/plain +*.qbk text svneol=native#text/plain +*.rst text svneol=native#text/plain +*.sql text svneol=native#text/x-sql +*.txt text svneol=native#text/plain +*.xhtml text svneol=native#text/xhtml%2Bxml +*.xml text svneol=native#text/xml +*.xsd text svneol=native#text/xml +*.xsl text svneol=native#text/xml +*.xslt text svneol=native#text/xml +*.xul text svneol=native#text/xul +*.yml text svneol=native#text/plain +boost-no-inspect text svneol=native#text/plain +CHANGES text svneol=native#text/plain +COPYING text svneol=native#text/plain +INSTALL text svneol=native#text/plain +Jamfile text svneol=native#text/plain +Jamroot text svneol=native#text/plain +Jamfile.v2 text svneol=native#text/plain +Jamrules text svneol=native#text/plain +Makefile* text svneol=native#text/plain +README text svneol=native#text/plain +TODO text svneol=native#text/plain + +# Code formats +*.c text svneol=native#text/plain +*.cpp text svneol=native#text/plain +*.h text svneol=native#text/plain +*.hpp text svneol=native#text/plain +*.ipp text svneol=native#text/plain +*.tpp text svneol=native#text/plain +*.jam text svneol=native#text/plain +*.java text svneol=native#text/plain diff --git a/include/boost/range.hpp b/include/boost/range.hpp new file mode 100755 index 0000000..ea1ea45 --- /dev/null +++ b/include/boost/range.hpp @@ -0,0 +1,23 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_HPP +#define BOOST_RANGE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include + +#endif diff --git a/include/boost/range/begin.hpp b/include/boost/range/begin.hpp new file mode 100755 index 0000000..dce7052 --- /dev/null +++ b/include/boost/range/begin.hpp @@ -0,0 +1,115 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_BEGIN_HPP +#define BOOST_RANGE_BEGIN_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +#include +#else + +#include +#include + +namespace boost +{ +namespace range +{ + + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template< typename C > + inline BOOST_DEDUCED_TYPENAME const_iterator_of::type + begin( const C& c ) + { + return c.begin(); + } + + template< typename C > + inline BOOST_DEDUCED_TYPENAME iterator_of::type + begin( C& c ) + { + return c.begin(); + } + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + inline Iterator begin( const std::pair& p ) + { + return p.first; + } + + template< typename Iterator > + inline Iterator begin( std::pair& p ) + { + return p.first; + } + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + inline const T* begin( const T (&array)[sz] ) + { + return array; + } + + template< typename T, std::size_t sz > + inline T* begin( T (&array)[sz] ) + { + return array; + } + + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + inline const char* begin( const char* s ) + { + return s; + } + + inline char* begin( char* s ) + { + return s; + } + + inline const wchar_t* begin( const wchar_t* s ) + { + return s; + } + + inline wchar_t* begin( wchar_t* s ) + { + return s; + } + +} // namespace 'range' + +using range::begin; + +} // namespace boost + +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +#endif diff --git a/include/boost/range/config.hpp b/include/boost/range/config.hpp new file mode 100755 index 0000000..703615f --- /dev/null +++ b/include/boost/range/config.hpp @@ -0,0 +1,48 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_CONFIG_HPP +#define BOOST_RANGE_CONFIG_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include + +#ifdef BOOST_CT_DEDUCED_TYPENAME +#error "macro already defined!" +#endif + +#ifdef __BORLANDC__ +#define BOOST_CT_DEDUCED_TYPENAME +#else +#define BOOST_CT_DEDUCED_TYPENAME BOOST_DEDUCED_TYPENAME +#endif + +#ifdef BOOST_CT_NO_ARRAY_SUPPORT +#error "macro already defined!" +#endif + +#if _MSC_VER <= 1200 && !defined( __COMO__ ) && !defined( _GNUC_ ) +#define BOOST_CT_NO_ARRAY_SUPPORT +#endif + +#ifdef BOOST_CT_NO_ARRAY_SUPPORT +#define BOOST_ARRAY_REF (array) +#define BOOST_CT_NO_STATIC_ASSERT +#else +#define BOOST_ARRAY_REF (&array) +#endif + + + +#endif + diff --git a/include/boost/range/const_iterator.hpp b/include/boost/range/const_iterator.hpp new file mode 100755 index 0000000..b05df54 --- /dev/null +++ b/include/boost/range/const_iterator.hpp @@ -0,0 +1,103 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_CONST_ITERATOR_HPP +#define BOOST_RANGE_CONST_ITERATOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else + +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct const_iterator_of + { + typedef BOOST_DEDUCED_TYPENAME C::const_iterator type; + }; + + ////////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + struct const_iterator_of< std::pair > + { + typedef Iterator type; + }; + + template< typename Iterator > + struct const_iterator_of< const std::pair > + { + typedef Iterator type; + }; + + ////////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + struct const_iterator_of< T[sz] > + { + typedef const T* type; + }; + + template< typename T, std::size_t sz > + struct const_iterator_of< const T[sz] > + { + typedef const T* type; + }; + + ////////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////////// + + template<> + struct const_iterator_of< char* > + { + typedef const char* type; + }; + + template<> + struct const_iterator_of< wchar_t* > + { + typedef const wchar_t* type; + }; + + template<> + struct const_iterator_of< const char* > + { + typedef const char* type; + }; + + template<> + struct const_iterator_of< const wchar_t* > + { + typedef const wchar_t* type; + }; + +} // namespace boost + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif diff --git a/include/boost/range/const_reverse_iterator.hpp b/include/boost/range/const_reverse_iterator.hpp new file mode 100755 index 0000000..e0fef78 --- /dev/null +++ b/include/boost/range/const_reverse_iterator.hpp @@ -0,0 +1,37 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_CONST_REVERSE_ITERATOR_HPP +#define BOOST_RANGE_CONST_REVERSE_ITERATOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct const_reverse_iterator_of + { + typedef reverse_iterator< + BOOST_DEDUCED_TYPENAME const_iterator_of::type > type; + }; + +} // namespace boost + +#endif diff --git a/include/boost/range/detail/begin.hpp b/include/boost/range/detail/begin.hpp new file mode 100755 index 0000000..ddd068a --- /dev/null +++ b/include/boost/range/detail/begin.hpp @@ -0,0 +1,120 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_BEGIN_HPP +#define BOOST_RANGE_DETAIL_BEGIN_HPP + +#include +#include + +namespace boost +{ + + namespace range_detail + { + template< typename T > + struct range_begin; + + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_begin + { + template< typename C > + static BOOST_CT_DEDUCED_TYPENAME result_iterator_of::type fun( C& c ) + { + return c.begin(); + }; + }; + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_begin + { + template< typename P > + static BOOST_CT_DEDUCED_TYPENAME result_iterator_of

::type fun( const P& p ) + { + return p.first; + } + }; + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_begin + { + template< typename T, std::size_t sz > + static T* fun( T BOOST_ARRAY_REF[sz] ) + { + return array; + } + }; + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_begin + { + static char* fun( char* s ) + { + return s; + } + }; + + template<> + struct range_begin + { + static const char* fun( const char* s ) + { + return s; + } + }; + + template<> + struct range_begin + { + + static wchar_t* fun( wchar_t* s ) + { + return s; + } + }; + + template<> + struct range_begin + { + static const wchar_t* fun( const wchar_t* s ) + { + return s; + } + }; + + } // namespace 'range_traits_detail' + + template< typename C > + inline BOOST_DEDUCED_TYPENAME result_iterator_of::type + begin( C& c ) + { + return range_traits_detail::range_begin< BOOST_DEDUCED_TYPENAME range_traits_detail::range::type >::fun( c ); + } + +} // namespace 'boost' + + +#endif diff --git a/include/boost/range/detail/common.hpp b/include/boost/range/detail/common.hpp new file mode 100755 index 0000000..5ab12a2 --- /dev/null +++ b/include/boost/range/detail/common.hpp @@ -0,0 +1,117 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_COMMON_HPP +#define BOOST_RANGE_DETAIL_COMMON_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// missing partial specialization workaround. +////////////////////////////////////////////////////////////////////////////// + +namespace boost +{ + namespace range_detail + { + // 1 = std containers + // 2 = std::pair + // 3 = const std::pair + // 4 = array + // 5 = const array + // 6 = char array + // 7 = wchar_t array + // 8 = char* + // 9 = const char* + // 10 = whar_t* + // 11 = const wchar_t* + // 12 = string + + typedef mpl::int_<1>::type std_container_; + typedef mpl::int_<2>::type std_pair_; + typedef mpl::int_<3>::type const_std_pair_; + typedef mpl::int_<4>::type array_; + typedef mpl::int_<5>::type const_array_; + typedef mpl::int_<6>::type char_array_; + typedef mpl::int_<7>::type wchar_t_array_; + typedef mpl::int_<8>::type char_ptr_; + typedef mpl::int_<9>::type const_char_ptr_; + typedef mpl::int_<10>::type wchar_t_ptr_; + typedef mpl::int_<11>::type const_wchar_t_ptr_; + typedef mpl::int_<12>::type string_; + + template< typename C > + struct collection_helper + { + static C* c; + static C ptr; + + BOOST_STATIC_CONSTANT( bool, is_pair_ = sizeof( boost::range_detail::is_pair_impl( c ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_char_ptr_ = sizeof( boost::range_detail::is_char_ptr_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_const_char_ptr_ = sizeof( boost::range_detail::is_const_char_ptr_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_wchar_t_ptr_ = sizeof( boost::range_detail::is_wchar_t_ptr_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_const_wchar_t_ptr_ = sizeof( boost::range_detail::is_const_wchar_t_ptr_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_char_array_ = sizeof( boost::range_detail::is_char_array_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_wchar_t_array_ = sizeof( boost::range_detail::is_wchar_t_array_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_string_ = (boost::type_traits::ice_or::value )); + BOOST_STATIC_CONSTANT( bool, is_array_ = boost::is_array::value ); + + }; + + template< typename C > + class range + { + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper::is_pair_, + boost::range_detail::std_pair_, + void >::type pair_t; + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper::is_array_, + boost::range_detail::array_, + pair_t >::type array_t; + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper::is_string_, + boost::range_detail::string_, + array_t >::type string_t; + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper::is_const_char_ptr_, + boost::range_detail::const_char_ptr_, + string_t >::type const_char_ptr_t; + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper::is_char_ptr_, + boost::range_detail::char_ptr_, + const_char_ptr_t >::type char_ptr_t; + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper::is_const_wchar_t_ptr_, + boost::range_detail::const_wchar_t_ptr_, + char_ptr_t >::type const_wchar_ptr_t; + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper::is_wchar_t_ptr_, + boost::range_detail::wchar_t_ptr_, + const_wchar_ptr_t >::type wchar_ptr_t; + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper::is_wchar_t_array_, + boost::range_detail::wchar_t_array_, + wchar_ptr_t >::type wchar_array_t; + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper::is_char_array_, + boost::range_detail::char_array_, + wchar_array_t >::type char_array_t; + public: + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::is_void::value, + boost::range_detail::std_container_, + char_array_t >::type type; + }; // class 'range' + } +} + +#endif diff --git a/include/boost/range/detail/const_iterator.hpp b/include/boost/range/detail/const_iterator.hpp new file mode 100755 index 0000000..2e9c9a3 --- /dev/null +++ b/include/boost/range/detail/const_iterator.hpp @@ -0,0 +1,102 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_CONST_ITERATOR_HPP +#define BOOST_RANGE_DETAIL_CONST_ITERATOR_HPP + +#include + +////////////////////////////////////////////////////////////////////////////// +// missing partial specialization workaround. +////////////////////////////////////////////////////////////////////////////// + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct range_const_iterator_; + + template<> + struct range_const_iterator_ + { + template< typename C > + struct pts + { + typedef BOOST_DEDUCED_TYPENAME C::const_iterator type; + }; + }; + + template<> + struct range_const_iterator_ + { + template< typename P > + struct pts + { + typedef BOOST_DEDUCED_TYPENAME P::first_type type; + }; + }; + + template<> + struct range_const_iterator_; // give up + + template<> + struct range_const_iterator_ + { + template< typename S > + struct pts + { + typedef const char* type; + }; + }; + + template<> + struct range_const_iterator_ + { + template< typename S > + struct pts + { + typedef const char* type; + }; + }; + + template<> + struct range_const_iterator_ + { + template< typename S > + struct pts + { + typedef const wchar_t* type; + }; + }; + + template<> + struct range_const_iterator_ + { + template< typename S > + struct pts + { + typedef const wchar_t* type; + }; + }; + + } + + template< typename C > + class const_iterator_of + { + typedef BOOST_DEDUCED_TYPENAME range_detail::range::type c_type; + public: + typedef BOOST_DEDUCED_TYPENAME range_detail::range_const_iterator_::BOOST_NESTED_TEMPLATE pts::type type; + }; + +} + +#endif diff --git a/include/boost/range/detail/difference_type.hpp b/include/boost/range/detail/difference_type.hpp new file mode 100755 index 0000000..ad9cda2 --- /dev/null +++ b/include/boost/range/detail/difference_type.hpp @@ -0,0 +1,111 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_DIFFERENCE_TYPE_HPP +#define BOOST_RANGE_DETAIL_DIFFERENCE_TYPE_HPP + +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// missing partial specialization workaround. +////////////////////////////////////////////////////////////////////////////// + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct range_difference_type_; + + template<> + struct range_difference_type_ + { + template< typename C > + struct pts + { + typedef BOOST_DEDUCED_TYPENAME C::difference_type type; + }; + }; + + template<> + struct range_difference_type_ + { + template< typename P > + struct pts + { + typedef BOOST_CT_DEDUCED_TYPENAME boost::iterator_difference< BOOST_DEDUCED_TYPENAME P::first_type>::type type; + }; + }; + + template<> + struct range_difference_type_ + { + template< typename A > + struct pts + { + typedef std::ptrdiff_t type; + }; + }; + + template<> + struct range_difference_type_ + { + template< typename S > + struct pts + { + typedef std::ptrdiff_t type; + }; + }; + + template<> + struct range_difference_type_ + { + template< typename S > + struct pts + { + typedef std::ptrdiff_t type; + }; + }; + + template<> + struct range_difference_type_ + { + template< typename S > + struct pts + { + typedef std::ptrdiff_t type; + }; + }; + + template<> + struct range_difference_type_ + { + template< typename S > + struct pts + { + typedef std::ptrdiff_t type; + }; + }; + + } + + template< typename C > + class difference_type_of + { + typedef BOOST_CT_DEDUCED_TYPENAME range_detail::range::type c_type; + public: + typedef BOOST_CT_DEDUCED_TYPENAME range_detail::range_difference_type_::BOOST_NESTED_TEMPLATE pts::type type; + }; + +} + +#endif + diff --git a/include/boost/range/detail/empty.hpp b/include/boost/range/detail/empty.hpp new file mode 100755 index 0000000..55a1c43 --- /dev/null +++ b/include/boost/range/detail/empty.hpp @@ -0,0 +1,120 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_EMPTY_HPP +#define BOOST_RANGE_DETAIL_EMPTY_HPP + +#include + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct collection_empty; + + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_empty + { + template< typename C > + static bool fun( C& c ) + { + return c.empty(); + }; + }; + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_empty + { + template< typename P > + static bool fun( const P& p ) + { + return p.first == p.second; + } + }; + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_empty + { + template< typename T, std::size_t sz > + static bool fun( T BOOST_ARRAY_REF[sz] ) + { + if( array == 0 ) + return true; + return false; + } + }; + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_empty + { + static bool fun( const char* s ) + { + return s == 0 || s[0] == 0; + } + }; + + template<> + struct collection_empty + { + static bool fun( const char* s ) + { + return s == 0 || s[0] == 0; + } + }; + + template<> + struct collection_empty + { + static bool fun( const wchar_t* s ) + { + return s == 0 || s[0] == 0; + } + }; + + template<> + struct collection_empty + { + static bool fun( const wchar_t* s ) + { + return s == 0 || s[0] == 0; + } + }; + + } // namespace 'range_detail' + + + template< typename C > + inline bool + empty( const C& c ) + { + return range_detail::collection_empty< BOOST_CT_DEDUCED_TYPENAME range_detail::collection::type >::fun( c ); + } + +} // namespace 'boost' + + +#endif diff --git a/include/boost/range/detail/end.hpp b/include/boost/range/detail/end.hpp new file mode 100755 index 0000000..1c6db52 --- /dev/null +++ b/include/boost/range/detail/end.hpp @@ -0,0 +1,141 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_END_HPP +#define BOOST_RANGE_DETAIL_END_HPP + +#include +#include +#include + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct collection_end; + + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_end + { + template< typename C > + static BOOST_CT_DEDUCED_TYPENAME result_iterator_of::type fun( C& c ) + { + return c.end(); + }; + }; + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_end + { + template< typename P > + static BOOST_CT_DEDUCED_TYPENAME result_iterator_of

::type fun( const P& p ) + { + return p.second; + } + }; + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_end + { + template< typename T, std::size_t sz > + static T* fun( T BOOST_ARRAY_REF[sz] ) + { + return boost::range_detail::array_end( array ); + } + }; + + + template<> + struct collection_end + { + template< typename T, std::size_t sz > + static std::size_t fun( T BOOST_ARRAY_REF[sz] ) + { + return boost::range_detail::array_end( array ); + } + }; + + template<> + struct collection_end + { + template< typename T, std::size_t sz > + static std::size_t fun( T BOOST_ARRAY_REF[sz] ) + { + return boost::range_detail::array_end( array ); + } + }; + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_end + { + static char* fun( char* s ) + { + return boost::range_detail::str_end( s ); + } + }; + + template<> + struct collection_end + { + static const char* fun( const char* s ) + { + return boost::range_detail::str_end( s ); + } + }; + + template<> + struct collection_end + { + static wchar_t* fun( wchar_t* s ) + { + return boost::range_detail::str_end( s ); + } + }; + + + template<> + struct collection_end + { + static const wchar_t* fun( const wchar_t* s ) + { + return boost::range_detail::str_end( s ); + } + }; + + } // namespace 'range_detail' + + template< typename C > + inline BOOST_DEDUCED_TYPENAME result_iterator_of::type + end( C& c ) + { + return range_detail::collection_end< BOOST_DEDUCED_TYPENAME range_detail::collection::type >::fun( c ); + } + +} // namespace 'boost' + + +#endif diff --git a/include/boost/range/detail/implementation_help.hpp b/include/boost/range/detail/implementation_help.hpp new file mode 100755 index 0000000..31dd469 --- /dev/null +++ b/include/boost/range/detail/implementation_help.hpp @@ -0,0 +1,161 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP +#define BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP + +#include +#include +#include +#include +#include + +#ifndef BOOST_NO_CWCHAR +#include +#endif + +namespace boost +{ + namespace range_detail + { + + ///////////////////////////////////////////////////////////////////// + // end() help + ///////////////////////////////////////////////////////////////////// + + inline const char* str_end( const char* s, const char* ) + { + return s + strlen( s ); + } + +#ifndef BOOST_NO_CWCHAR + inline const wchar_t* str_end( const wchar_t* s, const wchar_t* ) + { + return s + wcslen( s ); + } +#else + inline const wchar_t* str_end( const wchar_t* s, const wchar_t* ) + { + if( s == 0 && s[0] == 0 ) + return s; + while( *++s != 0 ) + ; + return s; + } +#endif + + template< typename Char > + inline Char* str_end( Char* s ) + { + return (Char*)str_end( s, s ); + } + + template< typename T, std::size_t sz > + inline T* array_end( T (&array)[sz], int ) + { + return array + sz; + } + + template< typename T, std::size_t sz > + inline const T* array_end( const T (&array)[sz], int ) + { + return array + sz; + } + + template< typename T, std::size_t sz > + inline T* array_end( T (&arrays)[sz], char_or_wchar_t_array_tag ) + { + return array + sz - 1; + } + + template< typename T, std::size_t sz > + inline const T* array_end( const T (&array)[sz], char_or_wchar_t_array_tag ) + { + return array + sz - 1; + } + + template< typename T, std::size_t sz > + inline T* array_end( T (&array)[sz] ) + { + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< is_same::value || is_same::value, + char_or_wchar_t_array_tag, + int >::type tag; + + return array_end( array, tag() ); + } + + template< typename T, std::size_t sz > + inline const T* array_end( const T (&array)[sz] ) + { + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< is_same::value || is_same::value, + char_or_wchar_t_array_tag, + int >::type tag; + + return array_end( array, tag() ); + } + + ///////////////////////////////////////////////////////////////////// + // size() help + ///////////////////////////////////////////////////////////////////// + + template< typename Char > + inline std::size_t str_size( const Char* s ) + { + return str_end( s ) - s; + } + + template< typename T, std::size_t sz > + inline std::size_t array_size( T BOOST_ARRAY_REF[sz], int ) + { + return sz; + } + + template< typename T, std::size_t sz > + inline std::size_t array_size( const T BOOST_ARRAY_REF[sz], int ) + { + return sz; + } + + template< typename T, std::size_t sz > + inline std::size_t array_size( T BOOST_ARRAY_REF[sz], char_or_wchar_t_array_tag ) + { + return sz - 1; + } + + template< typename T, std::size_t sz > + inline std::size_t array_size( const T BOOST_ARRAY_REF[sz], char_or_wchar_t_array_tag ) + { + return sz - 1; + } + + template< typename T, std::size_t sz > + inline std::size_t array_size( T (&array)[sz] ) + { + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< is_same::value || is_same::value, + char_or_wchar_t_array_tag, + int >::type tag; + return array_size( array, tag() ); + } + + template< typename T, std::size_t sz > + inline std::size_t array_size( const T (&array)[sz] ) + { + typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< is_same::value || is_same::value, + char_or_wchar_t_array_tag, + int >::type tag; + return array_size( array, tag() ); + } + + } // namespace 'range_detail' + +} // namespace 'boost' + + +#endif diff --git a/include/boost/range/detail/iterator.hpp b/include/boost/range/detail/iterator.hpp new file mode 100755 index 0000000..bc67b17 --- /dev/null +++ b/include/boost/range/detail/iterator.hpp @@ -0,0 +1,101 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_ITERATOR_HPP +#define BOOST_RANGE_DETAIL_ITERATOR_HPP + +#include + +////////////////////////////////////////////////////////////////////////////// +// missing partial specialization workaround. +////////////////////////////////////////////////////////////////////////////// + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct range_iterator_; + + template<> + struct range_iterator_ + { + template< typename C > + struct pts + { + typedef BOOST_DEDUCED_TYPENAME C::iterator type; + }; + }; + + template<> + struct range_iterator_ + { + template< typename P > + struct pts + { + typedef BOOST_DEDUCED_TYPENAME P::first_type type; + }; + }; + + template<> + struct range_iterator_; // give up + + template<> + struct range_iterator_ + { + template< typename S > + struct pts + { + typedef char* type; + }; + }; + + template<> + struct range_iterator_ + { + template< typename S > + struct pts + { + typedef const char* type; + }; + }; + + template<> + struct range_iterator_ + { + template< typename S > + struct pts + { + typedef wchar_t* type; + }; + }; + + template<> + struct range_iterator_ + { + template< typename S > + struct pts + { + typedef const wchar_t* type; + }; + }; + + } + + template< typename C > + class iterator_of + { + typedef BOOST_DEDUCED_TYPENAME range_detail::range::type c_type; + public: + typedef BOOST_DEDUCED_TYPENAME range_detail::range_iterator_::BOOST_NESTED_TEMPLATE pts::type type; + }; +} + +#endif diff --git a/include/boost/range/detail/sfinae.hpp b/include/boost/range/detail/sfinae.hpp new file mode 100755 index 0000000..b0835b7 --- /dev/null +++ b/include/boost/range/detail/sfinae.hpp @@ -0,0 +1,77 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_SFINAE_HPP +#define BOOST_RANGE_DETAIL_SFINAE_HPP + +#include +#include +#include +#include + + +namespace boost +{ + namespace range_detail + { + using type_traits::yes_type; + using type_traits::no_type; + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + yes_type is_string_impl( const char* ); + yes_type is_string_impl( const wchar_t* ); + no_type is_string_impl( ... ); + + template< std::size_t sz > + yes_type is_char_array_impl( char BOOST_ARRAY_REF[sz] ); + template< std::size_t sz > + yes_type is_char_array_impl( const char BOOST_ARRAY_REF[sz] ); + no_type is_char_array_impl( ... ); + + template< std::size_t sz > + yes_type is_wchar_t_array_impl( wchar_t BOOST_ARRAY_REF[sz] ); + template< std::size_t sz > + yes_type is_wchar_t_array_impl( const wchar_t BOOST_ARRAY_REFx[sz] ); + no_type is_wchar_t_array_impl( ... ); + + yes_type is_char_ptr_impl( char* ); + no_type is_char_ptr_impl( ... ); + + yes_type is_const_char_ptr_impl( const char* ); + no_type is_const_char_ptr_impl( ... ); + + yes_type is_wchar_t_ptr_impl( wchar_t* ); + no_type is_wchar_t_ptr_impl( ... ); + + yes_type is_const_wchar_t_ptr_impl( const wchar_t* ); + no_type is_const_wchar_t_ptr_impl( ... ); + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + yes_type is_pair_impl( const std::pair* ); + no_type is_pair_impl( ... ); + + ////////////////////////////////////////////////////////////////////// + // tags + ////////////////////////////////////////////////////////////////////// + + struct char_or_wchar_t_array_tag {}; + + } // namespace 'range_detail' + +} // namespace 'boost' + +#endif diff --git a/include/boost/range/detail/size.hpp b/include/boost/range/detail/size.hpp new file mode 100755 index 0000000..eee1a16 --- /dev/null +++ b/include/boost/range/detail/size.hpp @@ -0,0 +1,142 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + + +#ifndef BOOST_RANGE_DETAIL_SIZE_HPP +#define BOOST_RANGE_DETAIL_SIZE_HPP + +#include +#include +#include +#include + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct collection_size; + + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_size + { + template< typename C > + static BOOST_CT_DEDUCED_TYPENAME C::size_type fun( const C& c ) + { + return c.size(); + }; + }; + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_size + { + template< typename P > + static BOOST_CT_DEDUCED_TYPENAME size_type_of

::type fun( const P& p ) + { + return std::distance( p.first, p.second ); + } + }; + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_size + { + template< typename T, std::size_t sz > + static std::size_t fun( T BOOST_ARRAY_REF[sz] ) + { + return sz; + } + }; + + template<> + struct collection_size + { + template< typename T, std::size_t sz > + static std::size_t fun( T BOOST_ARRAY_REF[sz] ) + { + return boost::range_detail::array_size( array ); + } + }; + + template<> + struct collection_size + { + template< typename T, std::size_t sz > + static std::size_t fun( T BOOST_ARRAY_REF[sz] ) + { + return boost::range_detail::array_size( array ); + } + }; + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + template<> + struct collection_size + { + static std::size_t fun( const char* s ) + { + return boost::range_detail::str_size( s ); + } + }; + + template<> + struct collection_size + { + static std::size_t fun( const char* s ) + { + return boost::range_detail::str_size( s ); + } + }; + + template<> + struct collection_size + { + static std::size_t fun( const wchar_t* s ) + { + return boost::range_detail::str_size( s ); + } + }; + + template<> + struct collection_size + { + static std::size_t fun( const wchar_t* s ) + { + return boost::range_detail::str_size( s ); + } + }; + + } // namespace 'range_detail' + + + template< typename C > + BOOST_CT_DEDUCED_TYPENAME size_type_of::type + size( const C& c ) + { + return range_detail::collection_size< BOOST_CT_DEDUCED_TYPENAME range_detail::collection::type >::fun( c ); + } + +} // namespace 'boost' + + +#endif diff --git a/include/boost/range/detail/size_type.hpp b/include/boost/range/detail/size_type.hpp new file mode 100755 index 0000000..e01fad3 --- /dev/null +++ b/include/boost/range/detail/size_type.hpp @@ -0,0 +1,109 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_SIZE_TYPE_HPP +#define BOOST_RANGE_DETAIL_SIZE_TYPE_HPP + +#include + +////////////////////////////////////////////////////////////////////////////// +// missing partial specialization workaround. +////////////////////////////////////////////////////////////////////////////// + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct range_size_type_; + + template<> + struct range_size_type_ + { + template< typename C > + struct pts + { + typedef BOOST_DEDUCED_TYPENAME C::size_type type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename P > + struct pts + { + typedef std::size_t type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename A > + struct pts + { + typedef std::size_t type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename S > + struct pts + { + typedef std::size_t type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename S > + struct pts + { + typedef std::size_t type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename S > + struct pts + { + typedef std::size_t type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename S > + struct pts + { + typedef std::size_t type; + }; + }; + + } + + template< typename C > + class size_type_of + { + typedef BOOST_DEDUCED_TYPENAME range_detail::range::type c_type; + public: + typedef BOOST_DEDUCED_TYPENAME range_detail::range_size_type_::BOOST_NESTED_TEMPLATE pts::type type; + }; +} + +#endif + diff --git a/include/boost/range/detail/sizer.hpp b/include/boost/range/detail/sizer.hpp new file mode 100755 index 0000000..412329f --- /dev/null +++ b/include/boost/range/detail/sizer.hpp @@ -0,0 +1,37 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_SIZER_HPP +#define BOOST_RANGE_DETAIL_SIZER_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////// + // constant array size + ////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + char& + sizer( const T BOOST_ARRAY_REF[sz] )[sz]; + + template< typename T, std::size_t sz > + char& + sizer( T BOOST_ARRAY_REF[sz] )[sz]; + +} // namespace 'boost' + +#endif diff --git a/include/boost/range/detail/value_type.hpp b/include/boost/range/detail/value_type.hpp new file mode 100755 index 0000000..12d2afe --- /dev/null +++ b/include/boost/range/detail/value_type.hpp @@ -0,0 +1,104 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_VALUE_TYPE_HPP +#define BOOST_RANGE_DETAIL_VALUE_TYPE_HPP + +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// missing partial specialization workaround. +////////////////////////////////////////////////////////////////////////////// + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct range_value_type_; + + template<> + struct range_value_type_ + { + template< typename C > + struct pts + { + typedef BOOST_DEDUCED_TYPENAME C::value_type type; + }; + }; + + template<> + struct range_value_type_ + { + template< typename P > + struct pts + { + typedef BOOST_DEDUCED_TYPENAME boost::iterator_value< BOOST_CT_DEDUCED_TYPENAME P::first_type >::type type; + }; + }; + + template<> + struct range_value_type_; // give up + + template<> + struct range_value_type_ + { + template< typename S > + struct pts + { + typedef char type; + }; + }; + + template<> + struct range_value_type_ + { + template< typename S > + struct pts + { + typedef const char type; + }; + }; + + template<> + struct range_value_type_ + { + template< typename S > + struct pts + { + typedef wchar_t type; + }; + }; + + template<> + struct range_value_type_ + { + template< typename S > + struct pts + { + typedef const wchar_t type; + }; + }; + + } + + template< typename C > + class value_type_of + { + typedef BOOST_DEDUCED_TYPENAME range_detail::range::type c_type; + public: + typedef BOOST_DEDUCED_TYPENAME range_detail::range_value_type_::BOOST_NESTED_TEMPLATE pts::type type; + }; + +} + +#endif + diff --git a/include/boost/range/difference_type.hpp b/include/boost/range/difference_type.hpp new file mode 100755 index 0000000..6a82f69 --- /dev/null +++ b/include/boost/range/difference_type.hpp @@ -0,0 +1,107 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_DIFFERENCE_TYPE_HPP +#define BOOST_RANGE_DIFFERENCE_TYPE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else + +#include +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct difference_type_of + { + typedef BOOST_DEDUCED_TYPENAME C::difference_type type; + }; + + ////////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + struct difference_type_of< std::pair > + { + typedef BOOST_DEDUCED_TYPENAME + iterator_difference::type type; + }; + + template< typename Iterator > + struct difference_type_of< const std::pair > + { + typedef BOOST_DEDUCED_TYPENAME + iterator_difference::type type; + }; + + + ////////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + struct difference_type_of< T[sz] > + { + typedef std::ptrdiff_t type; + }; + + template< typename T, std::size_t sz > + struct difference_type_of< const T[sz] > + { + typedef std::ptrdiff_t type; + }; + + ////////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////////// + + template<> + struct difference_type_of< char* > + { + typedef std::ptrdiff_t type; + }; + + template<> + struct difference_type_of< wchar_t* > + { + typedef std::ptrdiff_t type; + }; + + template<> + struct difference_type_of< const char* > + { + typedef std::ptrdiff_t type; + }; + + template<> + struct difference_type_of< const wchar_t* > + { + typedef std::ptrdiff_t type; + }; + +} // namespace boost + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif diff --git a/include/boost/range/empty.hpp b/include/boost/range/empty.hpp new file mode 100755 index 0000000..b48ecda --- /dev/null +++ b/include/boost/range/empty.hpp @@ -0,0 +1,62 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_EMPTY_HPP +#define BOOST_RANGE_EMPTY_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +#include +#else + +#include +#include + +namespace boost +{ +namespace range +{ + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template< typename C > + inline bool empty( const C& c ) + { + return begin( c ) == end( c ); + } + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + inline bool empty( const char* s ) + { + return s == 0 || s[0] == 0; + } + + inline bool empty( const wchar_t* s ) + { + return s == 0 || s[0] == 0; + } + +} // namespace 'range' + +using range::empty; + +} // namepace 'boost' + +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +#endif diff --git a/include/boost/range/end.hpp b/include/boost/range/end.hpp new file mode 100755 index 0000000..c67fdcb --- /dev/null +++ b/include/boost/range/end.hpp @@ -0,0 +1,115 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_END_HPP +#define BOOST_RANGE_END_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +#include +#else + +#include +#include +#include + +namespace boost +{ +namespace range +{ + + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template< typename C > + inline BOOST_DEDUCED_TYPENAME const_iterator_of::type + end( const C& c ) + { + return c.end(); + } + + template< typename C > + inline BOOST_DEDUCED_TYPENAME iterator_of::type + end( C& c ) + { + return c.end(); + } + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + inline Iterator end( const std::pair& p ) + { + return p.second; + } + + template< typename Iterator > + inline Iterator end( std::pair& p ) + { + return p.second; + } + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + inline const T* end( const T (&array)[sz] ) + { + return range_detail::array_end( array ); + } + + template< typename T, std::size_t sz > + inline T* end( T (&array)[sz] ) + { + return range_detail::array_end( array ); + } + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + inline char* end( char* s ) + { + return range_detail::str_end( s ); + } + + inline wchar_t* end( wchar_t* s ) + { + return range_detail::str_end( s ); + } + + inline const char* end( const char* s ) + { + return range_detail::str_end( s ); + } + + inline const wchar_t* end( const wchar_t* s ) + { + return range_detail::str_end( s ); + } + +} // namespace 'range' + +using range::end; + +} // namespace 'boost' + +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +#endif diff --git a/include/boost/range/functions.hpp b/include/boost/range/functions.hpp new file mode 100755 index 0000000..5b5fb54 --- /dev/null +++ b/include/boost/range/functions.hpp @@ -0,0 +1,25 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_FUNCTIONS_HPP +#define BOOST_RANGE_FUNCTIONS_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/range/iterator.hpp b/include/boost/range/iterator.hpp new file mode 100755 index 0000000..6dfe0ca --- /dev/null +++ b/include/boost/range/iterator.hpp @@ -0,0 +1,105 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_ITERATOR_HPP +#define BOOST_RANGE_ITERATOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else + +#include +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct iterator_of + { + typedef BOOST_DEDUCED_TYPENAME C::iterator type; + }; + + ////////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + struct iterator_of< std::pair > + { + typedef Iterator type; + }; + + template< typename Iterator > + struct iterator_of< const std::pair > + { + typedef Iterator type; + }; + + ////////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + struct iterator_of< T[sz] > + { + typedef T* type; + }; + + template< typename T, std::size_t sz > + struct iterator_of< const T[sz] > + { + // remark: is this correct? I think T* should be it! + typedef const T* type; + }; + + ////////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////////// + + template<> + struct iterator_of< char* > + { + typedef char* type; + }; + + template<> + struct iterator_of< wchar_t* > + { + typedef wchar_t* type; + }; + + template<> + struct iterator_of< const char* > + { + typedef const char* type; + }; + + template<> + struct iterator_of< const wchar_t* > + { + typedef const wchar_t* type; + }; + +} // namespace boost + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif diff --git a/include/boost/range/iterator_range.hpp b/include/boost/range/iterator_range.hpp new file mode 100755 index 0000000..4a5a1b7 --- /dev/null +++ b/include/boost/range/iterator_range.hpp @@ -0,0 +1,300 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen & Pavol Droba 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_ITERATOR_RANGE_HPP +#define BOOST_RANGE_ITERATOR_RANGE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/*! \file + Defines the \c iterator_class and related functions. + \c iterator_range is a simple wrapper of iterator pair idiom. It provides + a rich subset of Container interface. +*/ + +namespace boost { + +// iterator range template class -----------------------------------------// + + //! iterator_range class + /*! + An \c iterator_range delimits a range in a sequence by beginning and ending iterators. + An iterator_range can be passed to an algorithm which requires a sequence as an input. + For example, the \c toupper() function may be used most frequently on strings, + but can also be used on iterator_ranges: + + \code + boost::tolower( find( s, "UPPERCASE STRING" ) ); + \endcode + + Many algorithms working with sequences take a pair of iterators, + delimiting a working range, as an arguments. The \c iterator_range class is an + encapsulation of a range identified by a pair of iterators. + It provides a collection interface, + so it is possible to pass an instance to an algorithm requiring a collection as an input. + */ + template + class iterator_range + { + public: + //! this type + typedef iterator_range type; + //! Encapsulated value type + typedef BOOST_DEDUCED_TYPENAME boost:: + iterator_value::type value_type; + //! Difference type + typedef BOOST_DEDUCED_TYPENAME boost:: + iterator_difference::type difference_type; + //! Size type + typedef std::size_t size_type; // note: must be unsigned + + //! const_iterator type + /*! + There is no distinction between const_iterator and iterator. + These typedefs are provides to fulfill container interface + */ + typedef IteratorT const_iterator; + //! iterator type + typedef IteratorT iterator; + + //! Default constructor + iterator_range() {} + + //! Constructor from a pair of iterators + iterator_range( iterator Begin, iterator End ) : + m_Begin(Begin), m_End(End) {} + + //! Constructor from a Range + template< class Range > + iterator_range( const Range& r ) : + m_Begin( boost::begin( r ) ), m_End( boost::end( r ) ) {} + + //! Constructor from a Range + template< class Range > + iterator_range( Range& r ) : + m_Begin( boost::begin( r ) ), m_End( boost::end( r ) ) {} + + //! Copy constructor + iterator_range( const iterator_range& Other ) : + m_Begin(Other.begin()), m_End(Other.end()) {} + + //! Templated copy constructor + /*! + This constructor is provided to allow conversion between + const and mutable iterator instances of this class template + */ + template< typename OtherItT > + iterator_range( const iterator_range& Other ) : + m_Begin(Other.begin()), m_End(Other.end()) {} + + //! Assignment operator + iterator_range& operator=( const iterator_range& Other ) + { + m_Begin=Other.begin(); m_End=Other.end(); + return *this; + } + + //! Assignment operator ( templated version ) + template< typename OtherItT > + iterator_range& operator=( const iterator_range& Other ) + { + m_Begin=Other.begin(); m_End=Other.end(); + return *this; + } + + //! Comparison operator ( equal ) + /*! + Compare operands for equality + */ + template< typename OtherItT > + bool operator==( const iterator_range& Other ) const + { + return ! (*this != Other); + } + + //! Comparison operator ( not-equal ) + /*! + Compare operands for non-equality + */ + template< typename OtherItT > + bool operator!=( const iterator_range& Other ) const + { + return m_Begin!=Other.begin() || m_End!=Other.end(); + } + + //! begin access + /*! + Retrieve the begin iterator + */ + IteratorT begin() const + { + return m_Begin; + } + + //! end access + /*! + Retrieve the end iterator + */ + IteratorT end() const + { + return m_End; + } + + //! Size of the range + /*! + Retrieve the size of the range + */ + size_type size() const + { + return boost::size( make_pair( begin(), end() ) ); + } + + //! Swap + /*! + Swap two ranges + */ + void swap( iterator_range& Other ) + { + std::swap( m_Begin, Other.begin() ); + std::swap( m_End, Other.end() ); + } + + //! Safe bool conversion + /*! + Check whenever the range is empty. + Allows to use construction like this: + \code + iterator_range r; + if (!r) + { + ... + } + \endcode + */ + typedef iterator (iterator_range::*unspecified_bool_type) () const; + operator unspecified_bool_type() const + { + return empty( *this )? 0: &iterator_range::end; + } + + /* + inline operator t_type() const + { + return make_tuple( m_Begin, m_End ); + }*/ + + private: + // begin and end iterators + IteratorT m_Begin; + IteratorT m_End; + }; + +// iterator range free-standing operators ---------------------------// + + //! iterator_range output operator + /*! + Output the range to an ostream. Elements are outputed + in a sequence without separators. + */ + template< typename IteratorT, typename Elem, typename Traits > + std::basic_ostream& operator<<( + std::basic_ostream& Os, + const iterator_range& r ) + { + std::copy( begin(r), end(r), std::ostream_iterator(Os)); + + return Os; + } + + +// iterator range utilities -----------------------------------------// + + //! iterator_range construct helper + /*! + Construct an \c iterator_range from a pair of iterators + + \param Begin A begin iterator + \param End An end iterator + \return iterator_range object + */ + template< typename IteratorT > + inline iterator_range< IteratorT > + make_iterator_range( IteratorT Begin, IteratorT End ) + { + return iterator_range( Begin, End ); + } + + //! iterator_range construct helper + /*! + Construct an \c iterator_range from a \c Range containing the begin + and end iterators. + */ + template< typename Range > + inline iterator_range< BOOST_DEDUCED_TYPENAME iterator_of::type > + make_iterator_range( Range& r ) + { + return iterator_range< BOOST_DEDUCED_TYPENAME iterator_of::type > + ( r ); + } + + template< typename Range > + inline iterator_range< BOOST_DEDUCED_TYPENAME const_iterator_of::type > + make_iterator_range( const Range& r ) + { + return iterator_range< BOOST_DEDUCED_TYPENAME const_iterator_of::type > + ( r ); + } + + //! copy a range into a sequence + /*! + Construct a new sequence of the specified type from the elements + in the given range + + \param Range An input range + \return New sequence + */ + template< typename SeqT, typename Range > + inline SeqT copy_range( const Range& r ) + { + return SeqT( begin( r ), end( r ) ); + } + + //! transform a range into a sequence + /*! + Create a new sequence from the elements in the range, transformed + by a function + + \param Range An input range + \param Func Transformation function + \return New sequence + */ + template< typename SeqT, typename Range, typename FuncT > + inline SeqT transform_range( const Range& r, FuncT Func ) + { + SeqT Seq; + std::transform( begin( r ), end( r ), std::back_inserter(Seq), Func ); + return Seq; + } + +} // namespace 'boost' + + +#endif diff --git a/include/boost/range/rbegin.hpp b/include/boost/range/rbegin.hpp new file mode 100755 index 0000000..ac518b6 --- /dev/null +++ b/include/boost/range/rbegin.hpp @@ -0,0 +1,41 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_RBEGIN_HPP +#define BOOST_RANGE_RBEGIN_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + +template< class C > +inline BOOST_DEDUCED_TYPENAME reverse_iterator_of::type +rbegin( C& c ) +{ + return BOOST_DEDUCED_TYPENAME reverse_iterator_of::type( end( c ) ); +} + +template< class C > +inline BOOST_DEDUCED_TYPENAME const_reverse_iterator_of::type +rbegin( const C& c ) +{ + return BOOST_DEDUCED_TYPENAME const_reverse_iterator_of::type( end( c ) ); +} + +} + +#endif diff --git a/include/boost/range/rend.hpp b/include/boost/range/rend.hpp new file mode 100755 index 0000000..36138f9 --- /dev/null +++ b/include/boost/range/rend.hpp @@ -0,0 +1,41 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_REND_HPP +#define BOOST_RANGE_REND_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + +template< class C > +inline BOOST_DEDUCED_TYPENAME reverse_iterator_of::type +rend( C& c ) +{ + return BOOST_DEDUCED_TYPENAME reverse_iterator_of::type( begin( c ) ); +} + +template< class C > +inline BOOST_DEDUCED_TYPENAME const_reverse_iterator_of::type +rend( const C& c ) +{ + return BOOST_DEDUCED_TYPENAME const_reverse_iterator_of::type( begin( c ) ); +} + +} // namespace 'boost' + +#endif diff --git a/include/boost/range/result_iterator.hpp b/include/boost/range/result_iterator.hpp new file mode 100755 index 0000000..0ed728e --- /dev/null +++ b/include/boost/range/result_iterator.hpp @@ -0,0 +1,43 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_RESULT_ITERATOR_HPP +#define BOOST_RANGE_RESULT_ITERATOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct result_iterator_of + { + typedef BOOST_CT_DEDUCED_TYPENAME + mpl::if_< BOOST_DEDUCED_TYPENAME is_const::type, + BOOST_DEDUCED_TYPENAME const_iterator_of::type, + BOOST_DEDUCED_TYPENAME iterator_of::type >::type type; + }; + +} // namespace boost + +//#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif diff --git a/include/boost/range/reverse_iterator.hpp b/include/boost/range/reverse_iterator.hpp new file mode 100755 index 0000000..299d57c --- /dev/null +++ b/include/boost/range/reverse_iterator.hpp @@ -0,0 +1,40 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_REVERSE_ITERATOR_HPP +#define BOOST_RANGE_REVERSE_ITERATOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct reverse_iterator_of + { + typedef reverse_iterator< + BOOST_DEDUCED_TYPENAME iterator_of::type > type; + }; + + +} // namespace boost + + +#endif diff --git a/include/boost/range/reverse_result_iterator.hpp b/include/boost/range/reverse_result_iterator.hpp new file mode 100755 index 0000000..2943d23 --- /dev/null +++ b/include/boost/range/reverse_result_iterator.hpp @@ -0,0 +1,39 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_REVERSE_RESULT_ITERATOR_HPP +#define BOOST_RANGE_REVERSE_RESULT_ITERATOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct reverse_result_iterator_of + { + typedef reverse_iterator< + BOOST_DEDUCED_TYPENAME result_iterator_of::type > type; + }; + +} // namespace boost + +//#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif diff --git a/include/boost/range/size.hpp b/include/boost/range/size.hpp new file mode 100755 index 0000000..10554aa --- /dev/null +++ b/include/boost/range/size.hpp @@ -0,0 +1,92 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_SIZE_HPP +#define BOOST_RANGE_SIZE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +#include +#else + +#include +#include +#include +#include + +namespace boost { +namespace range +{ + + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template< typename C > + inline BOOST_CT_DEDUCED_TYPENAME C::size_type + size( const C& c ) + { + return c.size(); + } + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + inline std::size_t size( const std::pair& p ) + { + return std::distance( p.first, p.second ); + } + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + inline std::size_t size( const T (&array)[sz] ) + { + return range_detail::array_size( array ); + } + + template< typename T, std::size_t sz > + inline std::size_t size( T (&array)[sz] ) + { + return range_detail::array_size( array ); + } + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + inline std::size_t size( const char* s ) + { + return range_detail::str_size( s ); + } + + inline std::size_t size( const wchar_t* s ) + { + return range_detail::str_size( s ); + } + +} // namespace 'range' + +using range::size; + +} // namespace 'boost' + +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +#endif diff --git a/include/boost/range/size_type.hpp b/include/boost/range/size_type.hpp new file mode 100755 index 0000000..0288822 --- /dev/null +++ b/include/boost/range/size_type.hpp @@ -0,0 +1,103 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_SIZE_TYPE_HPP +#define BOOST_RANGE_SIZE_TYPE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else + +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct size_type_of + { + typedef BOOST_DEDUCED_TYPENAME C::size_type type; + }; + + ////////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + struct size_type_of< std::pair > + { + typedef std::size_t type; + }; + + template< typename Iterator > + struct size_type_of< const std::pair > + { + typedef std::size_t type; + }; + + ////////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + struct size_type_of< T[sz] > + { + typedef std::size_t type; + }; + + template< typename T, std::size_t sz > + struct size_type_of< const T[sz] > + { + typedef std::size_t type; + }; + + ////////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////////// + + template<> + struct size_type_of< char* > + { + typedef std::size_t type; + }; + + template<> + struct size_type_of< wchar_t* > + { + typedef std::size_t type; + }; + + template<> + struct size_type_of< const char* > + { + typedef std::size_t type; + }; + + template<> + struct size_type_of< const wchar_t* > + { + typedef std::size_t type; + }; + +} // namespace boost + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif diff --git a/include/boost/range/sub_range.hpp b/include/boost/range/sub_range.hpp new file mode 100755 index 0000000..634780a --- /dev/null +++ b/include/boost/range/sub_range.hpp @@ -0,0 +1,126 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_SUB_RANGE_HPP +#define BOOST_RANGE_SUB_RANGE_HPP + +#include +#include +#include +#include +#include +#include +//#include +//#include + +namespace boost +{ + + template< class Range > + class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME result_iterator_of::type > + { + typedef BOOST_DEDUCED_TYPENAME result_iterator_of::type iterator_t; + typedef iterator_range< iterator_t > base; + + public: + using base::iterator; + using base::const_iterator; + using base::value_type; + typedef BOOST_DEDUCED_TYPENAME difference_type_of::type difference_type; + typedef BOOST_DEDUCED_TYPENAME size_type_of::type size_type; + + public: + template< class Range2 > + sub_range( Range2& r ) : base( r ) + { } + + template< class Range2 > + sub_range( const Range2& r ) : base( r ) + { } + + template< class Iter > + sub_range( Iter first, Iter last ) : + base( first, last ) + { } + + template< class Range2 > + sub_range& operator=( Range2& r ) + { + base::operator=( r ); + return *this; + } + + template< class Range2 > + sub_range& operator=( const Range2& r ) + { + base::operator=( r ); + return *this; + } + + size_type size() const + { + // + // performance discontinuity problem!! + // + return base::size(); + } + + }; + + + /* + template< class Range > + class reverse_sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME reverse_result_iterator_of::type > + { + typedef BOOST_DEDUCED_TYPENAME reverse_result_iterator_of::type + iterator_t; + typedef iterator_range base; + + public: + using base::iterator; + using base::const_iterator; + using base::value_type; + using base::difference_type; + using base::size_type; + + public: + template< class Range2 > + reverse_sub_range( Range2& r ) : base( rbegin( r ), rend( r ) ) + { } + + template< class Range2 > + reverse_sub_range( const Range2& r ) : base( rbegin( r ), rend( r ) ) + { } + + template< class Iter > + reverse_sub_range( Iter first, Iter last ) : + base( iterator_t( last ), iterator_t( first ) ) + { } + + template< class Range2 > + sub_range& operator=( Range2& r ) + { + base::operator=( r ); + return *this; + } + + template< class Range2 > + sub_range& operator=( const Range2& r ) + { + base::operator=( r ); + return *this; + } + + }; + */ + +} // namespace 'boost' + +#endif diff --git a/include/boost/range/types.hpp b/include/boost/range/types.hpp new file mode 100755 index 0000000..f0bd5cf --- /dev/null +++ b/include/boost/range/types.hpp @@ -0,0 +1,28 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_TYPES_HPP +#define BOOST_RANGE_TYPES_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/range/value_type.hpp b/include/boost/range/value_type.hpp new file mode 100755 index 0000000..7f38602 --- /dev/null +++ b/include/boost/range/value_type.hpp @@ -0,0 +1,108 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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/libs/range/ +// + +#ifndef BOOST_RANGE_VALUE_TYPE_HPP +#define BOOST_RANGE_VALUE_TYPE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else + +#include +#include +#include + + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct value_type_of + { + typedef BOOST_DEDUCED_TYPENAME C::value_type type; + }; + + ////////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + struct value_type_of< std::pair > + { + typedef BOOST_DEDUCED_TYPENAME + iterator_value::type type; + }; + + + template< typename Iterator > + struct value_type_of< const std::pair > + { + typedef BOOST_DEDUCED_TYPENAME + iterator_value::type type; + }; + + ////////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + struct value_type_of< T[sz] > + { + typedef T type; + }; + + template< typename T, std::size_t sz > + struct value_type_of< const T[sz] > + { + typedef const T type; + }; + + ////////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////////// + + template<> + struct value_type_of< char* > + { + typedef char type; + }; + + template<> + struct value_type_of< wchar_t* > + { + typedef wchar_t type; + }; + + template<> + struct value_type_of< const char* > + { + typedef const char type; + }; + + template<> + struct value_type_of< const wchar_t* > + { + typedef const wchar_t type; + }; + +} // namespace boost + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif