#endif // defined( __VISUALC__ )
/*
- Note: the outer helper class _WX_LIST_HELPER_##liT below is a workaround
+ Note 1: the outer helper class _WX_LIST_HELPER_##liT below is a workaround
for mingw 3.2.3 compiler bug that prevents a static function of liT class
from being exported into dll. A minimal code snippet reproducing the bug:
The program does not link under mingw_gcc 3.2.3 producing undefined
reference to Foo::Bar() function
+
+
+ Note 2: the EmptyList is needed to allow having a NULL pointer-like
+ invalid iterator. We used to use just an uninitialized iterator object
+ instead but this fails with some debug/checked versions of STL, notably the
+ glibc version activated with _GLIBCXX_DEBUG, so we need to have a separate
+ invalid iterator.
*/
// the real wxList-class declaration
decl liT : public std::list<elT> \
{ \
private: \
+ typedef std::list<elT> BaseListType; \
+ static BaseListType EmptyList; \
+ \
bool m_destroy; \
public: \
decl compatibility_iterator \
liT * m_list; \
public: \
compatibility_iterator() \
- : m_iter(), m_list( NULL ) {} \
+ : m_iter(EmptyList.end()), m_list( NULL ) {} \
compatibility_iterator( liT* li, iterator i ) \
: m_iter( i ), m_list( li ) {} \
compatibility_iterator( const liT* li, iterator i ) \
#if wxUSE_STL
- #undef WX_DEFINE_LIST
- #define WX_DEFINE_LIST(name) \
- void _WX_LIST_HELPER_##name::DeleteFunction( _WX_LIST_ITEM_TYPE_##name X ) \
- { \
- delete X; \
- }
+#undef WX_DEFINE_LIST
+#define WX_DEFINE_LIST(name) \
+ void _WX_LIST_HELPER_##name::DeleteFunction( _WX_LIST_ITEM_TYPE_##name X )\
+ { \
+ delete X; \
+ } \
+ name::BaseListType name::EmptyList;
-#else // if !wxUSE_STL
+#else // !wxUSE_STL
#define _DEFINE_LIST(T, name) \
void wx##name##Node::DeleteData() \
// don't pollute preprocessor's name space
//#undef _DEFINE_LIST
-#endif
+#endif // wxUSE_STL/!wxUSE_STL