forked from boostorg/range
*** empty log message ***
[SVN r23240]
This commit is contained in:
96
.gitattributes
vendored
Normal file
96
.gitattributes
vendored
Normal file
@ -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
|
23
include/boost/range.hpp
Executable file
23
include/boost/range.hpp
Executable file
@ -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 <boost/range/functions.hpp>
|
||||||
|
#include <boost/range/types.hpp>
|
||||||
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/sub_range.hpp>
|
||||||
|
|
||||||
|
#endif
|
115
include/boost/range/begin.hpp
Executable file
115
include/boost/range/begin.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
#include <boost/range/detail/begin.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range
|
||||||
|
{
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
inline BOOST_DEDUCED_TYPENAME const_iterator_of<C>::type
|
||||||
|
begin( const C& c )
|
||||||
|
{
|
||||||
|
return c.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
inline BOOST_DEDUCED_TYPENAME iterator_of<C>::type
|
||||||
|
begin( C& c )
|
||||||
|
{
|
||||||
|
return c.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// pair
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
inline Iterator begin( const std::pair<Iterator,Iterator>& p )
|
||||||
|
{
|
||||||
|
return p.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
inline Iterator begin( std::pair<Iterator,Iterator>& 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
|
48
include/boost/range/config.hpp
Executable file
48
include/boost/range/config.hpp
Executable file
@ -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 <boost/config.hpp>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
103
include/boost/range/const_iterator.hpp
Executable file
103
include/boost/range/const_iterator.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
#include <boost/range/detail/const_iterator.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
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<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
typedef Iterator type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
struct const_iterator_of< const std::pair<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
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
|
37
include/boost/range/const_reverse_iterator.hpp
Executable file
37
include/boost/range/const_reverse_iterator.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
#include <boost/iterator/reverse_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
struct const_reverse_iterator_of
|
||||||
|
{
|
||||||
|
typedef reverse_iterator<
|
||||||
|
BOOST_DEDUCED_TYPENAME const_iterator_of<C>::type > type;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif
|
120
include/boost/range/detail/begin.hpp
Executable file
120
include/boost/range/detail/begin.hpp
Executable file
@ -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 <boost/range/detail/result_iterator.hpp>
|
||||||
|
#include <boost/range/detail/common.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace range_detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct range_begin;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_begin<std_container_>
|
||||||
|
{
|
||||||
|
template< typename C >
|
||||||
|
static BOOST_CT_DEDUCED_TYPENAME result_iterator_of<C>::type fun( C& c )
|
||||||
|
{
|
||||||
|
return c.begin();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// pair
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_begin<std_pair_>
|
||||||
|
{
|
||||||
|
template< typename P >
|
||||||
|
static BOOST_CT_DEDUCED_TYPENAME result_iterator_of<P>::type fun( const P& p )
|
||||||
|
{
|
||||||
|
return p.first;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// array
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_begin<array_>
|
||||||
|
{
|
||||||
|
template< typename T, std::size_t sz >
|
||||||
|
static T* fun( T BOOST_ARRAY_REF[sz] )
|
||||||
|
{
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// string
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_begin<char_ptr_>
|
||||||
|
{
|
||||||
|
static char* fun( char* s )
|
||||||
|
{
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_begin<const_char_ptr_>
|
||||||
|
{
|
||||||
|
static const char* fun( const char* s )
|
||||||
|
{
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_begin<wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
|
||||||
|
static wchar_t* fun( wchar_t* s )
|
||||||
|
{
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_begin<const_wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
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<C>::type
|
||||||
|
begin( C& c )
|
||||||
|
{
|
||||||
|
return range_traits_detail::range_begin< BOOST_DEDUCED_TYPENAME range_traits_detail::range<C>::type >::fun( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace 'boost'
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
117
include/boost/range/detail/common.hpp
Executable file
117
include/boost/range/detail/common.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <boost/range/detail/sfinae.hpp>
|
||||||
|
#include <boost/type_traits/is_convertible.hpp>
|
||||||
|
#include <boost/type_traits/is_void.hpp>
|
||||||
|
#include <boost/type_traits/detail/ice_or.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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<is_const_char_ptr_, is_const_wchar_t_ptr_>::value ));
|
||||||
|
BOOST_STATIC_CONSTANT( bool, is_array_ = boost::is_array<C>::value );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
class range
|
||||||
|
{
|
||||||
|
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::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<C>::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<C>::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<C>::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<C>::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<C>::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<C>::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<C>::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<C>::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<char_array_t>::value,
|
||||||
|
boost::range_detail::std_container_,
|
||||||
|
char_array_t >::type type;
|
||||||
|
}; // class 'range'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
102
include/boost/range/detail/const_iterator.hpp
Executable file
102
include/boost/range/detail/const_iterator.hpp
Executable file
@ -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 <boost/range/detail/common.hpp>
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
// missing partial specialization workaround.
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range_detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct range_const_iterator_;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator_<std_container_>
|
||||||
|
{
|
||||||
|
template< typename C >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME C::const_iterator type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator_<std_pair_>
|
||||||
|
{
|
||||||
|
template< typename P >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME P::first_type type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator_<array_>; // give up
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator_<char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef const char* type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator_<const_char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef const char* type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator_<wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef const wchar_t* type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator_<const_wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef const wchar_t* type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
class const_iterator_of
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
|
||||||
|
public:
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_detail::range_const_iterator_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
111
include/boost/range/detail/difference_type.hpp
Executable file
111
include/boost/range/detail/difference_type.hpp
Executable file
@ -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 <boost/range/detail/common.hpp>
|
||||||
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
// missing partial specialization workaround.
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range_detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct range_difference_type_;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference_type_<std_container_>
|
||||||
|
{
|
||||||
|
template< typename C >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME C::difference_type type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference_type_<std_pair_>
|
||||||
|
{
|
||||||
|
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_<array_>
|
||||||
|
{
|
||||||
|
template< typename A >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference_type_<char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference_type_<const_char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference_type_<wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference_type_<const_wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
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<C>::type c_type;
|
||||||
|
public:
|
||||||
|
typedef BOOST_CT_DEDUCED_TYPENAME range_detail::range_difference_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
120
include/boost/range/detail/empty.hpp
Executable file
120
include/boost/range/detail/empty.hpp
Executable file
@ -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 <boost/range/detail/common.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range_detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct collection_empty;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_empty<std_container_>
|
||||||
|
{
|
||||||
|
template< typename C >
|
||||||
|
static bool fun( C& c )
|
||||||
|
{
|
||||||
|
return c.empty();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// pair
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_empty<std_pair_>
|
||||||
|
{
|
||||||
|
template< typename P >
|
||||||
|
static bool fun( const P& p )
|
||||||
|
{
|
||||||
|
return p.first == p.second;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// array
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_empty<array_>
|
||||||
|
{
|
||||||
|
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<char_ptr_>
|
||||||
|
{
|
||||||
|
static bool fun( const char* s )
|
||||||
|
{
|
||||||
|
return s == 0 || s[0] == 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_empty<const_char_ptr_>
|
||||||
|
{
|
||||||
|
static bool fun( const char* s )
|
||||||
|
{
|
||||||
|
return s == 0 || s[0] == 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_empty<wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
static bool fun( const wchar_t* s )
|
||||||
|
{
|
||||||
|
return s == 0 || s[0] == 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_empty<const_wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
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<C>::type >::fun( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace 'boost'
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
141
include/boost/range/detail/end.hpp
Executable file
141
include/boost/range/detail/end.hpp
Executable file
@ -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 <boost/range/detail/implementation_help.hpp>
|
||||||
|
#include <boost/range/detail/result_iterator.hpp>
|
||||||
|
#include <boost/range/detail/common.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range_detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct collection_end;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_end<std_container_>
|
||||||
|
{
|
||||||
|
template< typename C >
|
||||||
|
static BOOST_CT_DEDUCED_TYPENAME result_iterator_of<C>::type fun( C& c )
|
||||||
|
{
|
||||||
|
return c.end();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// pair
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_end<std_pair_>
|
||||||
|
{
|
||||||
|
template< typename P >
|
||||||
|
static BOOST_CT_DEDUCED_TYPENAME result_iterator_of<P>::type fun( const P& p )
|
||||||
|
{
|
||||||
|
return p.second;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// array
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_end<array_>
|
||||||
|
{
|
||||||
|
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<char_array_>
|
||||||
|
{
|
||||||
|
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<wchar_t_array_>
|
||||||
|
{
|
||||||
|
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<char_ptr_>
|
||||||
|
{
|
||||||
|
static char* fun( char* s )
|
||||||
|
{
|
||||||
|
return boost::range_detail::str_end( s );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_end<const_char_ptr_>
|
||||||
|
{
|
||||||
|
static const char* fun( const char* s )
|
||||||
|
{
|
||||||
|
return boost::range_detail::str_end( s );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_end<wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
static wchar_t* fun( wchar_t* s )
|
||||||
|
{
|
||||||
|
return boost::range_detail::str_end( s );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_end<const_wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
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<C>::type
|
||||||
|
end( C& c )
|
||||||
|
{
|
||||||
|
return range_detail::collection_end< BOOST_DEDUCED_TYPENAME range_detail::collection<C>::type >::fun( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace 'boost'
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
161
include/boost/range/detail/implementation_help.hpp
Executable file
161
include/boost/range/detail/implementation_help.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <boost/range/detail/common.hpp>
|
||||||
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_CWCHAR
|
||||||
|
#include <wchar.h>
|
||||||
|
#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<char,T>::value || is_same<wchar_t,T>::value,
|
||||||
|
char_or_wchar_t_array_tag,
|
||||||
|
int >::type tag;
|
||||||
|
|
||||||
|
return array_end<T,sz>( 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<char,T>::value || is_same<wchar_t,T>::value,
|
||||||
|
char_or_wchar_t_array_tag,
|
||||||
|
int >::type tag;
|
||||||
|
|
||||||
|
return array_end<T,sz>( 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<char,T>::value || is_same<wchar_t,T>::value,
|
||||||
|
char_or_wchar_t_array_tag,
|
||||||
|
int >::type tag;
|
||||||
|
return array_size<T,sz>( 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<char,T>::value || is_same<wchar_t,T>::value,
|
||||||
|
char_or_wchar_t_array_tag,
|
||||||
|
int >::type tag;
|
||||||
|
return array_size<T,sz>( array, tag() );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace 'range_detail'
|
||||||
|
|
||||||
|
} // namespace 'boost'
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
101
include/boost/range/detail/iterator.hpp
Executable file
101
include/boost/range/detail/iterator.hpp
Executable file
@ -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 <boost/range/detail/common.hpp>
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
// missing partial specialization workaround.
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range_detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct range_iterator_;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator_<std_container_>
|
||||||
|
{
|
||||||
|
template< typename C >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME C::iterator type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator_<std_pair_>
|
||||||
|
{
|
||||||
|
template< typename P >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME P::first_type type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator_<array_>; // give up
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator_<char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef char* type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator_<const_char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef const char* type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator_<wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef wchar_t* type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator_<const_wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef const wchar_t* type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
class iterator_of
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
|
||||||
|
public:
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_detail::range_iterator_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
77
include/boost/range/detail/sfinae.hpp
Executable file
77
include/boost/range/detail/sfinae.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <boost/type_traits/is_array.hpp>
|
||||||
|
#include <boost/type_traits/detail/yes_no_type.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
|
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<Iterator,Iterator>* );
|
||||||
|
no_type is_pair_impl( ... );
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// tags
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
struct char_or_wchar_t_array_tag {};
|
||||||
|
|
||||||
|
} // namespace 'range_detail'
|
||||||
|
|
||||||
|
} // namespace 'boost'
|
||||||
|
|
||||||
|
#endif
|
142
include/boost/range/detail/size.hpp
Executable file
142
include/boost/range/detail/size.hpp
Executable file
@ -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 <boost/range/detail/implementation_help.hpp>
|
||||||
|
#include <boost/range/detail/size_type.hpp>
|
||||||
|
#include <boost/range/detail/common.hpp>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range_detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct collection_size;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_size<std_container_>
|
||||||
|
{
|
||||||
|
template< typename C >
|
||||||
|
static BOOST_CT_DEDUCED_TYPENAME C::size_type fun( const C& c )
|
||||||
|
{
|
||||||
|
return c.size();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// pair
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_size<std_pair_>
|
||||||
|
{
|
||||||
|
template< typename P >
|
||||||
|
static BOOST_CT_DEDUCED_TYPENAME size_type_of<P>::type fun( const P& p )
|
||||||
|
{
|
||||||
|
return std::distance( p.first, p.second );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// array
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_size<array_>
|
||||||
|
{
|
||||||
|
template< typename T, std::size_t sz >
|
||||||
|
static std::size_t fun( T BOOST_ARRAY_REF[sz] )
|
||||||
|
{
|
||||||
|
return sz;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_size<char_array_>
|
||||||
|
{
|
||||||
|
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<wchar_t_array_>
|
||||||
|
{
|
||||||
|
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<char_ptr_>
|
||||||
|
{
|
||||||
|
static std::size_t fun( const char* s )
|
||||||
|
{
|
||||||
|
return boost::range_detail::str_size( s );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_size<const_char_ptr_>
|
||||||
|
{
|
||||||
|
static std::size_t fun( const char* s )
|
||||||
|
{
|
||||||
|
return boost::range_detail::str_size( s );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_size<wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
static std::size_t fun( const wchar_t* s )
|
||||||
|
{
|
||||||
|
return boost::range_detail::str_size( s );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct collection_size<const_wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
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<C>::type
|
||||||
|
size( const C& c )
|
||||||
|
{
|
||||||
|
return range_detail::collection_size< BOOST_CT_DEDUCED_TYPENAME range_detail::collection<C>::type >::fun( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace 'boost'
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
109
include/boost/range/detail/size_type.hpp
Executable file
109
include/boost/range/detail/size_type.hpp
Executable file
@ -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 <boost/range/detail/common.hpp>
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
// missing partial specialization workaround.
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range_detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct range_size_type_;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size_type_<std_container_>
|
||||||
|
{
|
||||||
|
template< typename C >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME C::size_type type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size_type_<std_pair_>
|
||||||
|
{
|
||||||
|
template< typename P >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size_type_<array_>
|
||||||
|
{
|
||||||
|
template< typename A >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size_type_<char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size_type_<const_char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size_type_<wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size_type_<const_wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
class size_type_of
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
|
||||||
|
public:
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
37
include/boost/range/detail/sizer.hpp
Executable file
37
include/boost/range/detail/sizer.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
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
|
104
include/boost/range/detail/value_type.hpp
Executable file
104
include/boost/range/detail/value_type.hpp
Executable file
@ -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 <boost/range/detail/common.hpp>
|
||||||
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
// missing partial specialization workaround.
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range_detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct range_value_type_;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value_type_<std_container_>
|
||||||
|
{
|
||||||
|
template< typename C >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME C::value_type type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value_type_<std_pair_>
|
||||||
|
{
|
||||||
|
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_<array_>; // give up
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value_type_<char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef char type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value_type_<const_char_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef const char type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value_type_<wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef wchar_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value_type_<const_wchar_t_ptr_>
|
||||||
|
{
|
||||||
|
template< typename S >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef const wchar_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
class value_type_of
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
|
||||||
|
public:
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_detail::range_value_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
107
include/boost/range/difference_type.hpp
Executable file
107
include/boost/range/difference_type.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
#include <boost/range/detail/difference_type.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
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<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME
|
||||||
|
iterator_difference<Iterator>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
struct difference_type_of< const std::pair<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME
|
||||||
|
iterator_difference<Iterator>::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
|
62
include/boost/range/empty.hpp
Executable file
62
include/boost/range/empty.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
#include <boost/range/detail/empty.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
|
||||||
|
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
|
115
include/boost/range/end.hpp
Executable file
115
include/boost/range/end.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
#include <boost/range/detail/end.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/range/detail/implementation_help.hpp>
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace range
|
||||||
|
{
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
inline BOOST_DEDUCED_TYPENAME const_iterator_of<C>::type
|
||||||
|
end( const C& c )
|
||||||
|
{
|
||||||
|
return c.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
inline BOOST_DEDUCED_TYPENAME iterator_of<C>::type
|
||||||
|
end( C& c )
|
||||||
|
{
|
||||||
|
return c.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// pair
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
inline Iterator end( const std::pair<Iterator,Iterator>& p )
|
||||||
|
{
|
||||||
|
return p.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
inline Iterator end( std::pair<Iterator,Iterator>& 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
|
25
include/boost/range/functions.hpp
Executable file
25
include/boost/range/functions.hpp
Executable file
@ -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 <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/size.hpp>
|
||||||
|
#include <boost/range/empty.hpp>
|
||||||
|
#include <boost/range/rbegin.hpp>
|
||||||
|
#include <boost/range/rend.hpp>
|
||||||
|
|
||||||
|
#endif
|
105
include/boost/range/iterator.hpp
Executable file
105
include/boost/range/iterator.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
#include <boost/range/detail/iterator.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
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<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
typedef Iterator type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
struct iterator_of< const std::pair<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
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
|
300
include/boost/range/iterator_range.hpp
Executable file
300
include/boost/range/iterator_range.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/empty.hpp>
|
||||||
|
#include <boost/range/size.hpp>
|
||||||
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
#include <iterator>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <ostream>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
|
||||||
|
/*! \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<typename IteratorT>
|
||||||
|
class iterator_range
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! this type
|
||||||
|
typedef iterator_range<IteratorT> type;
|
||||||
|
//! Encapsulated value type
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME boost::
|
||||||
|
iterator_value<IteratorT>::type value_type;
|
||||||
|
//! Difference type
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME boost::
|
||||||
|
iterator_difference<IteratorT>::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<OtherItT>& 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<OtherItT>& 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<OtherItT>& Other ) const
|
||||||
|
{
|
||||||
|
return ! (*this != Other);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Comparison operator ( not-equal )
|
||||||
|
/*!
|
||||||
|
Compare operands for non-equality
|
||||||
|
*/
|
||||||
|
template< typename OtherItT >
|
||||||
|
bool operator!=( const iterator_range<OtherItT>& 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<Elem,Traits>& operator<<(
|
||||||
|
std::basic_ostream<Elem, Traits>& Os,
|
||||||
|
const iterator_range<IteratorT>& r )
|
||||||
|
{
|
||||||
|
std::copy( begin(r), end(r), std::ostream_iterator<Elem>(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<IteratorT>( 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<Range>::type >
|
||||||
|
make_iterator_range( Range& r )
|
||||||
|
{
|
||||||
|
return iterator_range< BOOST_DEDUCED_TYPENAME iterator_of<Range>::type >
|
||||||
|
( r );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename Range >
|
||||||
|
inline iterator_range< BOOST_DEDUCED_TYPENAME const_iterator_of<Range>::type >
|
||||||
|
make_iterator_range( const Range& r )
|
||||||
|
{
|
||||||
|
return iterator_range< BOOST_DEDUCED_TYPENAME const_iterator_of<Range>::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
|
41
include/boost/range/rbegin.hpp
Executable file
41
include/boost/range/rbegin.hpp
Executable file
@ -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 <boost/range/end.hpp>
|
||||||
|
#include <boost/range/reverse_iterator.hpp>
|
||||||
|
#include <boost/range/const_reverse_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
|
||||||
|
template< class C >
|
||||||
|
inline BOOST_DEDUCED_TYPENAME reverse_iterator_of<C>::type
|
||||||
|
rbegin( C& c )
|
||||||
|
{
|
||||||
|
return BOOST_DEDUCED_TYPENAME reverse_iterator_of<C>::type( end( c ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class C >
|
||||||
|
inline BOOST_DEDUCED_TYPENAME const_reverse_iterator_of<C>::type
|
||||||
|
rbegin( const C& c )
|
||||||
|
{
|
||||||
|
return BOOST_DEDUCED_TYPENAME const_reverse_iterator_of<C>::type( end( c ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
41
include/boost/range/rend.hpp
Executable file
41
include/boost/range/rend.hpp
Executable file
@ -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 <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/reverse_iterator.hpp>
|
||||||
|
#include <boost/range/const_reverse_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
|
||||||
|
template< class C >
|
||||||
|
inline BOOST_DEDUCED_TYPENAME reverse_iterator_of<C>::type
|
||||||
|
rend( C& c )
|
||||||
|
{
|
||||||
|
return BOOST_DEDUCED_TYPENAME reverse_iterator_of<C>::type( begin( c ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class C >
|
||||||
|
inline BOOST_DEDUCED_TYPENAME const_reverse_iterator_of<C>::type
|
||||||
|
rend( const C& c )
|
||||||
|
{
|
||||||
|
return BOOST_DEDUCED_TYPENAME const_reverse_iterator_of<C>::type( begin( c ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace 'boost'
|
||||||
|
|
||||||
|
#endif
|
43
include/boost/range/result_iterator.hpp
Executable file
43
include/boost/range/result_iterator.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
struct result_iterator_of
|
||||||
|
{
|
||||||
|
typedef BOOST_CT_DEDUCED_TYPENAME
|
||||||
|
mpl::if_< BOOST_DEDUCED_TYPENAME is_const<C>::type,
|
||||||
|
BOOST_DEDUCED_TYPENAME const_iterator_of<C>::type,
|
||||||
|
BOOST_DEDUCED_TYPENAME iterator_of<C>::type >::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
//#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/range/reverse_iterator.hpp
Executable file
40
include/boost/range/reverse_iterator.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
|
#include <boost/iterator/reverse_iterator.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
struct reverse_iterator_of
|
||||||
|
{
|
||||||
|
typedef reverse_iterator<
|
||||||
|
BOOST_DEDUCED_TYPENAME iterator_of<C>::type > type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
39
include/boost/range/reverse_result_iterator.hpp
Executable file
39
include/boost/range/reverse_result_iterator.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <boost/range/result_iterator.hpp>
|
||||||
|
#include <boost/iterator/reverse_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// default
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template< typename C >
|
||||||
|
struct reverse_result_iterator_of
|
||||||
|
{
|
||||||
|
typedef reverse_iterator<
|
||||||
|
BOOST_DEDUCED_TYPENAME result_iterator_of<C>::type > type;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
//#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
#endif
|
92
include/boost/range/size.hpp
Executable file
92
include/boost/range/size.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
#include <boost/range/detail/size.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/range/detail/implementation_help.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <iterator>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
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<Iterator,Iterator>& 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
|
103
include/boost/range/size_type.hpp
Executable file
103
include/boost/range/size_type.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
#include <boost/range/detail/size_type.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
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<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
struct size_type_of< const std::pair<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
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
|
126
include/boost/range/sub_range.hpp
Executable file
126
include/boost/range/sub_range.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/result_iterator.hpp>
|
||||||
|
#include <boost/range/reverse_result_iterator.hpp>
|
||||||
|
#include <boost/range/size_type.hpp>
|
||||||
|
#include <boost/range/difference_type.hpp>
|
||||||
|
//#include <boost/range/rbegin.hpp>
|
||||||
|
//#include <boost/range/rend.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
|
||||||
|
template< class Range >
|
||||||
|
class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME result_iterator_of<Range>::type >
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME result_iterator_of<Range>::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<Range>::type difference_type;
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME size_type_of<Range>::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<Range>::type >
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME reverse_result_iterator_of<Range>::type
|
||||||
|
iterator_t;
|
||||||
|
typedef iterator_range<iterator_t> 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
|
28
include/boost/range/types.hpp
Executable file
28
include/boost/range/types.hpp
Executable file
@ -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 <boost/range/iterator.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
#include <boost/range/value_type.hpp>
|
||||||
|
#include <boost/range/size_type.hpp>
|
||||||
|
#include <boost/range/difference_type.hpp>
|
||||||
|
#include <boost/range/result_iterator.hpp>
|
||||||
|
#include <boost/range/reverse_iterator.hpp>
|
||||||
|
#include <boost/range/const_reverse_iterator.hpp>
|
||||||
|
#include <boost/range/reverse_result_iterator.hpp>
|
||||||
|
|
||||||
|
#endif
|
108
include/boost/range/value_type.hpp
Executable file
108
include/boost/range/value_type.hpp
Executable file
@ -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 <boost/range/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
#include <boost/range/detail/value_type.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
|
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<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME
|
||||||
|
iterator_value<Iterator>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
struct value_type_of< const std::pair<Iterator,Iterator> >
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME
|
||||||
|
iterator_value<Iterator>::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
|
Reference in New Issue
Block a user