3 #ifndef ACE_CHECKED_ITERATOR_H
4 #define ACE_CHECKED_ITERATOR_H
7 * @file checked_iterator.h
9 * @brief Checked iterator factory function.
11 * Some compilers (e.g. MSVC++ >= 8) issue security related
12 * diagnostics if algorithms such as std::copy() are used in an unsafe
13 * way. Normally this isn't an issue if STL container iterators are
14 * used in conjuction with the standard algorithms. However, in cases
15 * where application-specific iterators are use with standard
16 * algorithms that could potentially overrun a buffer, extra care must
17 * be taken to prevent such an overrun. If supported, checked
18 * iterators can be used to address the potential destination buffer
21 * This header provides function templates that generate the
22 * appropriate checked iterator. In cases where checked iterators are
23 * not supported, the pointer passed to the function is returned
26 * @internal The functions and types in this header are meant for
27 * internal use. They may change at any point between
30 * @author Ossama Othman
33 # if defined (_MSC_VER) && (_MSC_FULL_VER >= 140050000) && (!defined (_STLPORT_VERSION))
34 // Checked iterators are currently only supported in MSVC++ 8 or better.
36 # endif /* _MSC_VER >= 1400 && !_STLPORT_VERSION */
38 # if defined (_MSC_VER) && (_MSC_FULL_VER >= 140050000) && (!defined (_STLPORT_VERSION))
39 template <typename PTR
>
40 stdext::checked_array_iterator
<PTR
>
41 ACE_make_checked_array_iterator (PTR buf
, size_t len
)
43 return stdext::checked_array_iterator
<PTR
> (buf
, len
);
46 template <typename PTR
>
48 ACE_make_checked_array_iterator (PTR buf
, size_t /* len */)
50 // Checked iterators are unsupported. Just return the pointer to
54 # endif /* _MSC_VER >= 1400 && !_STLPORT_VERSION */
56 #endif /* ACE_CHECKED_ITERATOR_H */