Iterator support
[QuantLib macros]


Detailed Description

Some compilers still define the iterator struct outside the std namespace, only partially implement it, or do not implement it at all. For the code to be portable these macros should be used instead of the actual functions.


Defines

#define QL_ITERATOR   std::iterator
#define QL_ITERATOR_TRAITS   std::iterator_traits
#define QL_SPECIALIZE_ITERATOR_TRAITS(T)
#define QL_REVERSE_ITERATOR(iterator, type)   std::reverse_iterator< iterator >
 Blame Microsoft for this one...

#define QL_FULL_ITERATOR_SUPPORT


Define Documentation

#define QL_ITERATOR   std::iterator
 

Custom iterators should be derived from this struct for the code to be portable.

#define QL_ITERATOR_TRAITS   std::iterator_traits
 

For the code to be portable this macro should be used instead of the actual struct.

#define QL_SPECIALIZE_ITERATOR_TRAITS  ) 
 

When using the QuantLib implementation of iterator_traits or Visual C++ .Net, this macro might be needed to specialize QL_ITERATOR_TRAITS for a pointer to a user-defined type.

#define QL_REVERSE_ITERATOR iterator,
type   )     std::reverse_iterator< iterator >
 

Blame Microsoft for this one...

They decided that std::reverse_iterator<iterator> needed an extra template argument. For the code to be portable this macro should be used instead of the actual class.

#define QL_FULL_ITERATOR_SUPPORT
 

Some compilers (most notably, Visual C++) still do not fully support iterators in their STL implementation. This macro can be used to select between alternate implementations of blocks of code, namely, one that takes advantage of full iterator support and a less efficient one which is compatible with all compilers.


QuantLib.org
QuantLib
Hosted by
SourceForge.net Logo
Documentation generated by
doxygen