MFC Ranges

| Home | Libraries | People | FAQ | More

### 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 Range | `T&`
`CList<T,A>` | Bidirectional Range | `T&`
`CMap<K,AK,M,AM>` | Forward Range | `Range::CPair&`
`CTypedPtrArray<B,T*>` | Random Access Range | `T* const`
`CTypedPtrList<B,T*>` | Bidirectional Range | `T* const`
`CTypedPtrMap<B,T*,V*>` | Forward Range | `std::pair<T*,V*> const`
`CByteArray` | Random Access Range | `BYTE&`
`CDWordArray` | Random Access Range | `DWORD&`
`CObArray` | Random Access Range | `CObject*&`
`CPtrArray` | Random Access Range | `void*&`
`CStringArray` | Random Access Range | `CString&`
`CUIntArray` | Random Access Range | `UINT&`
`CWordArray` | Random Access Range | `WORD&`
`CObList` | Bidirectional Range | `CObject*&`
`CPtrList` | Bidirectional Range | `void*&`
`CStringList` | Bidirectional Range | `CString&`
`CMapPtrToWord` | Forward Range | `std::pair<void*,WORD> const`
`CMapPtrToPtr` | Forward Range | `std::pair<void*,void*> const`
`CMapStringToOb` | Forward Range | `std::pair<String,CObject*> const`
`CMapStringToString` | Forward Range | `Range::CPair&`
`CMapWordToOb` | Forward Range | `std::pair<WORD,CObject*> const`
`CMapWordToPtr` | Forward Range | `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 below.

Adam Walling has provided the header `<boost/range/mfc_map.hpp>` to add support for the map adaptor with MFC map types.