// STLIncomplete.h:
//
// This header file serves seveal purposes:
// 1) Forword declarations for STL classes
// 2) Processing of STLI_* macros that configure the STL implementation.
// 3) defines a STLI_DEFAULT_ALLOCATOR() macro that can be used for the
// Allocator template argument.
#ifndef INCL_STL_INCOMPLETE_H
#define INCL_STL_INCOMPLETE_H
// The following definitions can be set on the command-line, in the
// project, or in some header included before this header:
// STLI_DEFAULT_ARGS: compiler accepts default template arguments
// STLI_COMPLEX_DEFAULT_ARGS: compiler accepts default template
// arguments that depend on other template arguments
// STLI_STANDARD_ALLOCATOR: your STL supports a full standard allocator
// STLI_BYTE_ALLOCATE: when STLI_STANDARD_ALLOCATOR is false, then
// this macro is used to allocate arbitrarily-sized blocks.
// STLI_BYTE_DEALLOCATE: when STLI_STANDARD_ALLOCATOR is false, then
// this macro is used to free arbitrarily-sized blocks.
// STLI_STD_NAMESPACE: true if the STL defines the std namespace
// STLI_NAMESPACE_BROKEN: true if namespaces are largely unusable such
// that you must always unlock them -- "using namespace XXX"
//
// If you don't define any of these, then this header file will set
// the #defines for a maximally-compliant STL implementation.
//
// Some predefined sets of defines for specific compiler/STL combinations
//
#define STLI_IMP_STANDARD 1 // Standard-compliant STL
#define STLI_IMP_MSVC42_ROGUE 2 // MSVC++ 4.2 with Rogue wave STL
#define STLI_IMP_MSVC42_MSVC42 3 // MSVC++ 4.2 with internal STL
#define STLI_IMP_MSVC50_MSVC50 4 // MSVC++ 5.0 with internal STL
#define STLI_IMP_MSVC_DEFAULT 5 // Default MSVC++
// Attempt to choose an implementation based on compiler constants
#ifndef STLI_IMP
#if defined(_MSC_VER) && _MSC_VER == 1020
// The default implementation is set for MSVC++ 4.2 using internal STL
#define STLI_IMP STLI_IMP_MSVC42_MSVC42
#elif defined(_MSC_VER) && _MSC_VER == 1100
// The default implementation is set for MSVC++ 5.0 using internal STL
#define STLI_IMP STLI_IMP_MSVC50_MSVC50
#elif defined(_MSC_VER)
// For default MSVC++
#define STLI_IMP STLI_IMP_MSVC_DEFAULT
#endif
#endif
#if STLI_IMP == STLI_IMP_MSVC42_ROGUE
#define STLI_DEFAULT_ARGS 1
#define STLI_COMPLEX_DEFAULT_ARGS 0
#define STLI_STANDARD_ALLOCATOR 0
#define STLI_MEMBER_TEMPLATES 0
#define STLI_STD_NAMESPACE 0
#define STLI_NAMESPACE_BROKEN 1
#elif STLI_IMP == STLI_IMP_MSVC42_MSVC42
#define STLI_DEFAULT_ARGS 1
#define STLI_COMPLEX_DEFAULT_ARGS 0
#define STLI_STANDARD_ALLOCATOR 0
#define STLI_MEMBER_TEMPLATES 0
#define STLI_BYTE_ALLOCATE(allocator, amount) (void*)allocator.Charalloc(amount)
#define STLI_STD_NAMESPACE 0
#define STLI_NAMESPACE_BROKEN 1
#elif STLI_IMP == STLI_IMP_MSVC50_MSVC50
#define STLI_DEFAULT_ARGS 1
#define STLI_COMPLEX_DEFAULT_ARGS 0
#define STLI_STANDARD_ALLOCATOR 0
#define STLI_MEMBER_TEMPLATES 0
#define STLI_BYTE_ALLOCATE(allocator, amount) (void*)allocator._Charalloc(amount)
#define STLI_STD_NAMESPACE 1
#define STLI_NAMESPACE_BROKEN 1
#elif STLI_IMP == STLI_IMP_MSVC_DEFAULT
#define STLI_DEFAULT_ARGS 1
#define STLI_COMPLEX_DEFAULT_ARGS 0
#define STLI_STANDARD_ALLOCATOR 0
#define STLI_MEMBER_TEMPLATES 0
#define STLI_BYTE_ALLOCATE(allocator, amount) (void*)allocator._Charalloc(amount)
#define STLI_STD_NAMESPACE 1
#define STLI_NAMESPACE_BROKEN 1
#endif
//
// Set defines to maximally-compliant STL if not already set
//
#if !STLI_DEFAULT_ARGS
// Cannot have complex default args if there are no default args
#undef STLI_COMPLEX_DEFAULT_ARGS
#define STLI_COMPLEX_DEFAULT_ARGS 0
#endif
#ifndef STLI_DEFAULT_ARGS
#define STLI_DEFAULT_ARGS 1
#endif
#ifndef STLI_COMPLEX_DEFAULT_ARGS
#define STLI_COMPLEX_DEFAULT_ARGS 1
#endif
#ifndef STLI_STANDARD_ALLOCATOR
#define STLI_STANDARD_ALLOCATOR 1
#endif
#ifndef STLI_MEMBER_TEMPLATES
#define STLI_MEMBER_TEMPLATES 1
#endif
#ifndef STLI_STD_NAMESPACE
#define STLI_STD_NAMESPACE 1
#endif
#ifndef STLI_NAMESPACE_BROKEN
#define STLI_NAMESPACE_BROKEN 0
#endif
#if STLI_STD_NAMESPACE
namespace std {
#endif
// Define some macros to handle the two types of default template arguments
#if STLI_DEFAULT_ARGS
#define STLI_SIMPLE_DEFAULT_ARG(a) = a
#if !STLI_COMPLEX_DEFAULT_ARGS
#define STLI_SIMPLE_DEFAULT_ARG_WITH_ALLOC(a)
#else
#define STLI_SIMPLE_DEFAULT_ARG_WITH_ALLOC(a) = a
#endif
#else
#define STLI_SIMPLE_DEFAULT_ARG(a)
#define STLI_SIMPLE_DEFAULT_ARG_WITH_ALLOC(a)
#endif
#if STLI_COMPLEX_DEFAULT_ARGS
#define STLI_COMPLEX_DEFAULT_ARG(a) = a
#else
#define STLI_COMPLEX_DEFAULT_ARG(a)
#endif
// Forward allocator definition
template <class T> class allocator;
// Macro used for the default allocator argument
#define STLI_DEFAULT_ALLOCATOR_ARG(T) STLI_COMPLEX_DEFAULT_ARG(allocator<T> )
// Macro used to allocate arbitrary bytes via the allocator interface
#ifndef STLI_BYTE_ALLOCATE
#if !STLI_STANDARD_ALLOCATOR
#error "You must define STLI_BYTE_ALLOCATE in STLIncomplete.h"
#else
// Don't define byte allocation -- use the template constructor to
// get an allocator for the appropriate type.
#endif
#endif
// Macro used to free arbitrary bytes via the allocator interface
#ifndef STLI_BYTE_DECALLOCATE
// Use the standard method -- this works for most implementations
#define STLI_BYTE_DEALLOCATE(allocator, ptr) allocator.deallocate(ptr, 1)
#endif
// These are the common and simple ones
template <class T> struct less;
// Templates that use complex default arguments
template <class T, class Allocator STLI_DEFAULT_ALLOCATOR_ARG(T) > class deque;
template <class T, class Allocator STLI_DEFAULT_ALLOCATOR_ARG(T) > class list;
template <class T, class Allocator STLI_DEFAULT_ALLOCATOR_ARG(T) > class vector;
template <
class T,
class Imp STLI_COMPLEX_DEFAULT_ARG(deque<T>)
> class stack;
template <
class Key,
class T,
class Compare STLI_COMPLEX_DEFAULT_ARG(less<Key>),
class Allocator STLI_DEFAULT_ALLOCATOR_ARG(T)
> class map;
template <
class Key,
class T,
class Compare STLI_COMPLEX_DEFAULT_ARG(less<Key>),
class Allocator STLI_DEFAULT_ALLOCATOR_ARG(T)
> class multimap;
template <
class Key,
class Compare STLI_COMPLEX_DEFAULT_ARG(less<Key>),
class Allocator STLI_DEFAULT_ALLOCATOR_ARG(T)
> class set;
#if STLI_STD_NAMESPACE
} // namespace std
#endif
// non-std stuff
template <class T, class Allocator STLI_DEFAULT_ALLOCATOR_ARG(T) > class JL_DList;
#endif