forked from boostorg/range
https://svn.boost.org/svn/boost/trunk ........ r40923 | eric_niebler | 2007-11-07 22:48:08 -0800 (Wed, 07 Nov 2007) | 1 line fix errors and warnings on msvc-9 ........ r40924 | chris_kohlhoff | 2007-11-07 23:52:49 -0800 (Wed, 07 Nov 2007) | 2 lines Fix timer stalls. ........ r40925 | johnmaddock | 2007-11-08 01:38:22 -0800 (Thu, 08 Nov 2007) | 1 line Fixed license text. ........ r40926 | bemandawes | 2007-11-08 04:35:50 -0800 (Thu, 08 Nov 2007) | 1 line Borland appends newline, so just check text ........ r40927 | johnmaddock | 2007-11-08 04:39:58 -0800 (Thu, 08 Nov 2007) | 1 line Removed non-BSL files, updated and regenerated docs accordingly. ........ r40928 | bemandawes | 2007-11-08 05:01:23 -0800 (Thu, 08 Nov 2007) | 1 line Markup older Borland compilers that don't support enable_if ........ r40932 | bemandawes | 2007-11-08 06:25:09 -0800 (Thu, 08 Nov 2007) | 1 line Clarify comment ........ r40934 | joaquin | 2007-11-08 07:46:57 -0800 (Thu, 08 Nov 2007) | 1 line removed markup for a fixed failure of multi_index on vacpp ........ r40935 | nikiml | 2007-11-08 08:28:44 -0800 (Thu, 08 Nov 2007) | 1 line changed handle cast to downcast ........ r40936 | hljin | 2007-11-08 09:31:56 -0800 (Thu, 08 Nov 2007) | 1 line GIL: added missing standard C++ header files ........ r40937 | hljin | 2007-11-08 09:35:37 -0800 (Thu, 08 Nov 2007) | 1 line GIL: added namespace prefix to avoid confusion ........ r40938 | danieljames | 2007-11-08 10:04:12 -0800 (Thu, 08 Nov 2007) | 3 lines Remove the <small> from the copyright footer, because it was causing the markup to be invalid. ........ r40939 | johnmaddock | 2007-11-08 10:05:28 -0800 (Thu, 08 Nov 2007) | 1 line Applied fix from http://svn.boost.org/trac/boost/ticket/1023. ........ r40956 | vladimir_prus | 2007-11-09 00:26:47 -0800 (Fri, 09 Nov 2007) | 1 line Don't use toolset.register ........ r40957 | vladimir_prus | 2007-11-09 00:30:27 -0800 (Fri, 09 Nov 2007) | 2 lines Remove toolset.register. ........ r40958 | speedsnail | 2007-11-09 00:31:45 -0800 (Fri, 09 Nov 2007) | 2 lines Force static linking for toolsets mingw and boorland. ........ r40959 | speedsnail | 2007-11-09 01:28:29 -0800 (Fri, 09 Nov 2007) | 1 line Reverted the previous commit, until I find a better solution... ........ r40960 | johnmaddock | 2007-11-09 01:54:43 -0800 (Fri, 09 Nov 2007) | 1 line Still trying to get the Solaris error rates correct.... ........ r40961 | johnmaddock | 2007-11-09 01:59:37 -0800 (Fri, 09 Nov 2007) | 1 line Trivial fix for issue #647. ........ r40962 | nesotto | 2007-11-09 02:27:42 -0800 (Fri, 09 Nov 2007) | 1 line major update wrt. new range concepts ........ r40963 | johnmaddock | 2007-11-09 03:01:45 -0800 (Fri, 09 Nov 2007) | 1 line Improved error messages and added tentative fixes for HP Tru64: the compiler appears to store constants that should underflow to zero as a small non-zero values which messes up the logic used in the test cases. ........ r40964 | nesotto | 2007-11-09 05:13:06 -0800 (Fri, 09 Nov 2007) | 1 line minor editorial issue ........ r40965 | nesotto | 2007-11-09 05:30:57 -0800 (Fri, 09 Nov 2007) | 1 line update of new concepts, and replacement of range_size<T>::type with range_difference<T>::type throughut the library ........ r40966 | nesotto | 2007-11-09 05:31:43 -0800 (Fri, 09 Nov 2007) | 1 line minor tweaks to avoid warnings ... extension mechanism updated to follow new protocol ........ r40967 | schoepflin | 2007-11-09 06:25:44 -0800 (Fri, 09 Nov 2007) | 1 line Added memory barriers to Tru64 atomic ops. ........ r40968 | nesotto | 2007-11-09 07:15:28 -0800 (Fri, 09 Nov 2007) | 1 line improved reference ........ r40969 | johnmaddock | 2007-11-09 08:57:42 -0800 (Fri, 09 Nov 2007) | 1 line Added needed macro suppression to use of isfinite. ........ [SVN r40970]
233 lines
10 KiB
ReStructuredText
233 lines
10 KiB
ReStructuredText
|
|
++++++++++++++++++++++++++++++++
|
|
|Boost| Range MFC/ATL Extension
|
|
++++++++++++++++++++++++++++++++
|
|
|
|
.. |Boost| image:: http://www.boost.org/libs/ptr_container/doc/boost.png
|
|
|
|
|
|
|
|
:Author: Shunsuke Sogame
|
|
:Contact: mb2act@yahoo.co.jp
|
|
:date: 26th of May 2006
|
|
:copyright: Shunsuke Sogame 2005-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt__).
|
|
|
|
__ http://www.boost.org/LICENSE_1_0.txt
|
|
|
|
|
|
|
|
========
|
|
Overview
|
|
========
|
|
|
|
Boost.Range MFC/ATL Extension provides `Boost.Range`_ support for MFC/ATL collection and string types.
|
|
|
|
|
|
.. parsed-literal::
|
|
|
|
CTypedPtrArray<CPtrArray, CList<CString> \*> myArray;
|
|
...
|
|
BOOST_FOREACH (CList<CString> \*theList, myArray)
|
|
{
|
|
BOOST_FOREACH (CString& str, \*theList)
|
|
{
|
|
boost::to_upper(str);
|
|
std::sort(boost::begin(str), boost::end(str));
|
|
...
|
|
}
|
|
}
|
|
|
|
|
|
|
|
* `Requirements`_
|
|
* `MFC Ranges`_
|
|
* `ATL Ranges`_
|
|
* `const Ranges`_
|
|
* `References`_
|
|
|
|
|
|
|
|
============
|
|
Requirements
|
|
============
|
|
|
|
- `Boost C++ Libraries Version 1.34.0`__ or later (no compilation required)
|
|
- Visual C++ 7.1 or Visual C++ 8.0
|
|
|
|
__ Boost_
|
|
|
|
|
|
|
|
==========
|
|
MFC Ranges
|
|
==========
|
|
|
|
If the ``<boost/range/mfc.hpp>`` is included before or after `Boost.Range`_ headers,
|
|
the MFC collections and strings become models of Range.
|
|
The table below lists the Traversal Category and ``range_reference`` of MFC ranges.
|
|
|
|
|
|
============================= ================== =======================================
|
|
``Range`` Traversal Category ``range_reference<Range>::type``
|
|
============================= ================== =======================================
|
|
``CArray<T,A>`` Random Access ``T&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CList<T,A>`` Bidirectional ``T&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CMap<K,AK,M,AM>`` Forward ``Range::CPair&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CTypedPtrArray<B,T*>`` Random Access ``T* const``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CTypedPtrList<B,T*>`` Bidirectional ``T* const``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CTypedPtrMap<B,T*,V*>`` Forward ``std::pair<T*,V*> const``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CByteArray`` Random Access ``BYTE&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CDWordArray`` Random Access ``DWORD&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CObArray`` Random Access ``CObject* &``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CPtrArray`` Random Access ``void* &``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CStringArray`` Random Access ``CString&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CUIntArray`` Random Access ``UINT&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CWordArray`` Random Access ``WORD&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CObList`` Bidirectional ``CObject* &``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CPtrList`` Bidirectional ``void* &``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CStringList`` Bidirectional ``CString&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CMapPtrToWord`` Forward ``std::pair<void*,WORD> const``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CMapPtrToPtr`` Forward ``std::pair<void*,void*> const``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CMapStringToOb`` Forward ``std::pair<String,CObject*> const``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CMapStringToString`` Forward ``Range::CPair&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CMapWordToOb`` Forward ``std::pair<WORD,CObject*> const``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CMapWordToPtr`` Forward ``std::pair<WORD,void*> const``
|
|
============================= ================== =======================================
|
|
|
|
|
|
Other `Boost.Range`_ metafunctions are defined by the following.
|
|
Let ``Range`` be any type listed above and ``ReF`` be the same as ``range_reference<Range>::type``.
|
|
``range_value<Range>::type`` is the same as ``remove_reference<remove_const<Ref>::type>::type``,
|
|
``range_difference<Range>::type`` is the same as ``std::ptrdiff_t``, and
|
|
``range_pointer<Range>::type`` is the same as ``add_pointer<remove_reference<Ref>::type>::type``.
|
|
As for ``const Range``, see `const Ranges`_.
|
|
|
|
|
|
|
|
==========
|
|
ATL Ranges
|
|
==========
|
|
|
|
If the ``<boost/range/atl.hpp>`` is included before or after `Boost.Range`_ headers,
|
|
the ATL collections and strings become models of Range.
|
|
The table below lists the Traversal Category and ``range_reference`` of ATL ranges.
|
|
|
|
|
|
============================= ================== =======================================
|
|
``Range`` Traversal Category ``range_reference<Range>::type``
|
|
============================= ================== =======================================
|
|
``CAtlArray<E,ET>`` Random Access ``E&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CAutoPtrArray<E>`` Random Access ``E&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CInterfaceArray<I,pi>`` Random Access ``CComQIPtr<I,pi>&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CAtlList<E,ET>`` Bidirectional ``E&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CAutoPtrList<E>`` Bidirectional ``E&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CHeapPtrList<E,A>`` Bidirectional ``E&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CInterfaceList<I,pi>`` Bidirectional ``CComQIPtr<I,pi>&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CAtlMap<K,V,KT,VT>`` Forward ``Range::CPair&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CRBTree<K,V,KT,VT>`` Bidirectional ``Range::CPair&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CRBMap<K,V,KT,VT>`` Bidirectional ``Range::CPair&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CRBMultiMap<K,V,KT,VT>`` Bidirectional ``Range::CPair&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CSimpleStringT<B,b>`` Random Access ``B&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CStringT<B,ST>`` Random Access ``B&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CFixedStringT<S,n>`` Random Access ``range_reference<S>::type``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CStringT<B,ST>`` Random Access ``B&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CComBSTR`` Random Access ``OLECHAR&``
|
|
----------------------------- ------------------ ---------------------------------------
|
|
``CSimpleArray<T,TE>`` Random Access ``T&``
|
|
============================= ================== =======================================
|
|
|
|
|
|
Other `Boost.Range`_ metafunctions are defined by the following.
|
|
Let ``Range`` be any type listed above and ``ReF`` be the same as ``range_reference<Range>::type``.
|
|
``range_value<Range>::type`` is the same as ``remove_reference<Ref>::type``,
|
|
``range_difference<Range>::type`` is the same as ``std::ptrdiff_t``, and
|
|
``range_pointer<Range>::type`` is the same as ``add_pointer<remove_reference<Ref>::type>::type``.
|
|
As for ``const Range``, see `const Ranges`_.
|
|
|
|
|
|
|
|
============
|
|
const Ranges
|
|
============
|
|
|
|
``range_reference<const Range>::type`` is defined by the following algorithm.
|
|
Let ``Range`` be any type listed above and ``ReF`` be the same as ``range_reference<Range>::type``.
|
|
|
|
|
|
.. parsed-literal::
|
|
|
|
if (Range is CObArray || Range is CObList)
|
|
return CObject const \* &
|
|
else if (Range is CPtrArray || Range is CPtrList)
|
|
return void const \* &
|
|
else if (there is a type X such that X& is the same as ReF)
|
|
return X const &
|
|
else if (there is a type X such that X* const is the same as ReF)
|
|
return X const \* const
|
|
else
|
|
return ReF
|
|
|
|
|
|
Other `Boost.Range`_ metafunctions are defined by the following.
|
|
``range_value<const Range>::type`` is the same as ``range_value<Range>::type``,
|
|
``range_difference<const Range>::type`` is the same as ``std::ptrdiff_t``, and
|
|
``range_pointer<const Range>::type`` is the same as ``add_pointer<remove_reference<range_reference<const Range>::type>::type>::type``.
|
|
|
|
|
|
|
|
==========
|
|
References
|
|
==========
|
|
- `Boost.Range`_
|
|
- `MFC Collections`__
|
|
- `ATL Collection Classes`__
|
|
|
|
__ http://msdn2.microsoft.com/en-us/library/942860sh.aspx
|
|
__ http://msdn2.microsoft.com/en-US/library/15e672bd.aspx
|
|
|
|
|
|
|
|
.. _Boost C++ Libraries: http://www.boost.org/
|
|
.. _Boost: `Boost C++ Libraries`_
|
|
.. _Boost.Range: ../index.html
|
|
.. _forward: range.html#forward_range
|
|
.. _bidirectional: range.html#forward_range
|
|
.. _random access: range.html#random_access_range
|
|
|