Commit cded1574 authored by Brad King's avatar Brad King
Browse files

Remove support for pre-C++98 STL from hash_map and hash_set

Drop the KWSYS_STL_HAS_* checks needed only for hashtable compatibility
with old STL versions.

Change-Id: I164a40669881439f5853a72c60ab2065498a69c0
parent 5f3fd465
...@@ -344,39 +344,6 @@ ENDIF() ...@@ -344,39 +344,6 @@ ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDDEF KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDDEF
"Checking whether header cstddef is available" DIRECT) "Checking whether header cstddef is available" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ITERATOR_TRAITS
"Checking whether stl has iterator_traits" DIRECT)
IF(KWSYS_STL_HAS_ITERATOR_TRAITS)
SET(KWSYS_STL_HAS_ITERATOR_CATEGORY 0)
SET(KWSYS_STL_HAS___ITERATOR_CATEGORY 0)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ITERATOR_CATEGORY
"Checking whether stl has old iterator_category" DIRECT)
IF(KWSYS_STL_HAS_ITERATOR_CATEGORY)
SET(KWSYS_STL_HAS___ITERATOR_CATEGORY 0)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS___ITERATOR_CATEGORY
"Checking whether stl has internal __iterator_category" DIRECT)
ENDIF()
ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
"Checking whether stl has standard template allocator" DIRECT)
IF(KWSYS_STL_HAS_ALLOCATOR_TEMPLATE)
SET(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE 0)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_REBIND
"Checking for rebind member of stl allocator" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
"Checking for non-standard argument to stl allocator<>::max_size" DIRECT)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
"Checking whether stl has old non-template allocator" DIRECT)
SET(KWSYS_STL_HAS_ALLOCATOR_REBIND 0)
SET(KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT 0)
ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_OBJECTS
"Checking whether stl containers support allocator objects." DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
"Checking whether \"<>\" is needed for template friends" INVERT) "Checking whether \"<>\" is needed for template friends" INVERT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_MEMBER_TEMPLATES KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_MEMBER_TEMPLATES
......
...@@ -54,30 +54,6 @@ ...@@ -54,30 +54,6 @@
# define @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME typename # define @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME typename
#endif #endif
/* Whether the stl has iterator_traits. */
#define @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS @KWSYS_STL_HAS_ITERATOR_TRAITS@
/* Whether the stl has iterator_category. */
#define @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY @KWSYS_STL_HAS_ITERATOR_CATEGORY@
/* Whether the stl has __iterator_category. */
#define @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY @KWSYS_STL_HAS___ITERATOR_CATEGORY@
/* Whether the stl allocator is the standard template. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@
/* Whether the stl allocator is not a template. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@
/* Whether the stl allocator has rebind. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND @KWSYS_STL_HAS_ALLOCATOR_REBIND@
/* Whether the stl allocator has a size argument for max_size. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@
/* Whether the stl containers support allocator objects. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS @KWSYS_STL_HAS_ALLOCATOR_OBJECTS@
/* Whether struct stat has the st_mtim member for high resolution times. */ /* Whether struct stat has the st_mtim member for high resolution times. */
#define @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM @KWSYS_STAT_HAS_ST_MTIM@ #define @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM @KWSYS_STAT_HAS_ST_MTIM@
...@@ -95,15 +71,7 @@ ...@@ -95,15 +71,7 @@
# define KWSYS_CXX_HAS_FULL_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION # define KWSYS_CXX_HAS_FULL_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION
# define KWSYS_CXX_DEFINE_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION # define KWSYS_CXX_DEFINE_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
# define KWSYS_CXX_DECL_TYPENAME @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME # define KWSYS_CXX_DECL_TYPENAME @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME
# define KWSYS_STL_HAS_ALLOCATOR_REBIND @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
# define KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
# define KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP # define KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
# define KWSYS_STL_HAS_ITERATOR_TRAITS @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS
# define KWSYS_STL_HAS_ITERATOR_CATEGORY @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY
# define KWSYS_STL_HAS___ITERATOR_CATEGORY @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY
# define KWSYS_STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE
# define KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE
# define KWSYS_STL_HAS_ALLOCATOR_OBJECTS @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
# define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING # define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING
#endif #endif
......
...@@ -69,7 +69,7 @@ struct hash_select1st: ...@@ -69,7 +69,7 @@ struct hash_select1st:
template <class _Key, class _Tp, template <class _Key, class _Tp,
class _HashFcn = hash<_Key>, class _HashFcn = hash<_Key>,
class _EqualKey = std::equal_to<_Key>, class _EqualKey = std::equal_to<_Key>,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hash_map; class hash_map;
template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
...@@ -261,7 +261,7 @@ swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, ...@@ -261,7 +261,7 @@ swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
template <class _Key, class _Tp, template <class _Key, class _Tp,
class _HashFcn = hash<_Key>, class _HashFcn = hash<_Key>,
class _EqualKey = std::equal_to<_Key>, class _EqualKey = std::equal_to<_Key>,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hash_multimap; class hash_multimap;
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
......
...@@ -67,7 +67,7 @@ struct _Identity : public std::unary_function<_Tp,_Tp> ...@@ -67,7 +67,7 @@ struct _Identity : public std::unary_function<_Tp,_Tp>
template <class _Value, template <class _Value,
class _HashFcn = hash<_Value>, class _HashFcn = hash<_Value>,
class _EqualKey = std::equal_to<_Value>, class _EqualKey = std::equal_to<_Value>,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hash_set; class hash_set;
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
...@@ -255,7 +255,7 @@ swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, ...@@ -255,7 +255,7 @@ swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
template <class _Value, template <class _Value,
class _HashFcn = hash<_Value>, class _HashFcn = hash<_Value>,
class _EqualKey = std::equal_to<_Value>, class _EqualKey = std::equal_to<_Value>,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hash_multiset; class hash_multiset;
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
......
...@@ -73,238 +73,9 @@ ...@@ -73,238 +73,9 @@
# endif # endif
#endif #endif
#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE
# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) std::allocator< T >
#elif @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE
# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) std::allocator
#else
# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) std::alloc
#endif
#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
# define @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a) _M_buckets(__a)
# define @KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(__b) , __b.get_allocator()
#else
# define @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a) _M_buckets()
# define @KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(__b)
#endif
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
//----------------------------------------------------------------------------
// Define an allocator adaptor for platforms that do not provide an
// allocator with the rebind member.
#if !@KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
// Utility functions to convert item counts.
inline size_t hash_sizeof(void*) { return sizeof(char); }
inline size_t hash_sizeof(const void*) { return sizeof(char); }
template <class TPtr> inline size_t hash_sizeof(TPtr p)
{
static_cast<void>(p);
return sizeof(*p);
}
template <class POut, class PIn, class TSize>
inline TSize hash_allocator_n(POut out, PIn in, TSize n)
{
return n*(hash_sizeof(out)/hash_sizeof(in) +
(hash_sizeof(out)%hash_sizeof(in)>0));
}
// Define an allocation method to use the native allocator with
// the proper signature. The following signatures of the allocate
// method are used on various STL implementations:
// pointer allocate(size_type, const void* hint)
// pointer allocate(size_type)
// static pointer allocate(size_type, const void* hint)
// static pointer allocate(size_type)
// Where pointer might be a real type or void*.
// This set of overloads decodes the signature for a particular STL.
// The extra three int/long arguments will favor certain signatures
// over others in the case that multiple are present to avoid
// ambiguity errors.
template <class TAlloc, class PIn, class TSize, class THint, class POut>
inline void hash_allocate(TAlloc* a, PIn (TAlloc::*allocate)(TSize, THint),
TSize n_out, const void* hint, POut& out,
int, int, int)
{
TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
void* vout = (a->*allocate)(n_in, const_cast<THint>(hint));
out = static_cast<POut>(vout);
}
template <class TAlloc, class PIn, class TSize, class POut>
inline void hash_allocate(TAlloc* a, PIn (TAlloc::*allocate)(TSize),
TSize n_out, const void*, POut& out,
int, int, long)
{
TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
void* vout = (a->*allocate)(n_in);
out = static_cast<POut>(vout);
}
template <class PIn, class TSize, class THint, class POut>
inline void hash_allocate(void*, PIn (*allocate)(TSize, THint),
TSize n_out, const void* hint, POut& out,
int, long, long)
{
TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
void* vout = allocate(n_in, const_cast<THint>(hint));
out = static_cast<POut>(vout);
}
template <class PIn, class TSize, class POut>
inline void hash_allocate(void*, PIn (*allocate)(TSize),
TSize n_out, const void*, POut& out,
long, long, long)
{
TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
void* vout = allocate(n_in);
out = static_cast<POut>(vout);
}
// Define a deallocation method to use the native allocator with
// the proper signature. The following signatures of the deallocate
// method are used on various STL implementations:
// void deallocate(pointer, size_type)
// void deallocate(pointer)
// static void deallocate(pointer, size_type)
// static void deallocate(pointer)
// Where pointer might be a real type or void*.
// This set of overloads decodes the signature for a particular STL.
// The extra three int/long arguments will favor certain signatures
// over others in the case that multiple are present to avoid
// ambiguity errors.
template <class TAlloc, class PIn, class TSize, class PInReal, class POut>
inline void hash_deallocate(TAlloc* a, void (TAlloc::*deallocate)(PIn, TSize),
PInReal, POut p, TSize n_out, int, int, int)
{
TSize n_in = hash_allocator_n(POut(), PInReal(), n_out);
void* vout = p;
(a->*deallocate)(static_cast<PIn>(vout), n_in);
}
template <class TAlloc, class PIn, class TSize, class PInReal, class POut>
inline void hash_deallocate(TAlloc* a, void (TAlloc::*deallocate)(PIn),
PInReal, POut p, TSize, int, int, long)
{
void* vout = p;
(a->*deallocate)(static_cast<PIn>(vout));
}
template <class PIn, class TSize, class PInReal, class POut>
inline void hash_deallocate(void*, void (*deallocate)(PIn, TSize),
PInReal, POut p, TSize n_out, int, long, long)
{
TSize n_in = hash_allocator_n(POut(), PInReal(), n_out);
void* vout = p;
deallocate(static_cast<PIn>(vout), n_in);
}
template <class PIn, class TSize, class PInReal, class POut>
inline void hash_deallocate(void*, void (*deallocate)(PIn),
PInReal, POut p, TSize, long, long, long)
{
void* vout = p;
deallocate(static_cast<PIn>(vout));
}
// Use the same four overloads as hash_allocate to decode the type
// really used for allocation. This is passed as PInReal to the
// deallocate functions so that hash_allocator_n has the proper size.
template <class TAlloc, class PIn, class TSize, class THint>
inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize, THint),
int, int, int) { return 0; }
template <class TAlloc, class PIn, class TSize>
inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize),
int, int, long) { return 0; }
template <class PIn, class TSize, class THint>
inline PIn hash_allocate_type(PIn (*)(TSize, THint),
int, long, long) { return 0; }
template <class PIn, class TSize>
inline PIn hash_allocate_type(PIn (*)(TSize),
long, long, long) { return 0; }
// Define the comparison operators in terms of a base type to avoid
// needing templated versions.
class hash_allocator_base {};
inline bool operator==(const hash_allocator_base&,
const hash_allocator_base&) throw() { return true; }
inline bool operator!=(const hash_allocator_base&,
const hash_allocator_base&) throw() { return false; }
// Define the allocator template.
template <class T, class Alloc>
class hash_allocator: public hash_allocator_base
{
private:
// Store the real allocator privately.
typedef Alloc alloc_type;
alloc_type alloc_;
public:
// Standard allocator interface.
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
typedef T value_type;
hash_allocator() throw(): alloc_() {}
hash_allocator(const hash_allocator_base&) throw() : alloc_() {}
hash_allocator(const hash_allocator& a) throw() : alloc_(a.alloc_) {}
hash_allocator(const alloc_type& a) throw() : alloc_(a) {}
~hash_allocator() throw() {}
# if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class U>
struct rebind { typedef hash_allocator<U, alloc_type> other; };
# endif
pointer address(reference x) const { return &x; }
const_pointer address(const_reference x) const { return &x; }
typedef void* void_pointer;
typedef const void* const_void_pointer;
pointer allocate(size_type n=1, const_void_pointer hint = 0)
{
if(n)
{
pointer p;
hash_allocate(&alloc_, &alloc_type::allocate, n, hint, p, 1, 1, 1);
return p;
}
else
{
return 0;
}
}
void deallocate(pointer p, size_type n=1)
{
if(n)
{
hash_deallocate(&alloc_, &alloc_type::deallocate,
hash_allocate_type(&alloc_type::allocate, 1, 1, 1),
p, n, 1, 1, 1);
}
}
#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
size_type max_size(size_type s) const throw()
{
return alloc_.max_size(s);
}
#else
size_type max_size() const throw()
{
size_type n = alloc_.max_size() / sizeof(value_type);
return n>0? n:1;
}
#endif
void construct(pointer p, const value_type& val) { new (p) value_type(val); }
void destroy(pointer p) { (void)p; p->~value_type(); }
};
#endif
template <class _Val> template <class _Val>
struct _Hashtable_node struct _Hashtable_node
{ {
...@@ -317,7 +88,7 @@ private: ...@@ -317,7 +88,7 @@ private:
template <class _Val, class _Key, class _HashFcn, template <class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _ExtractKey, class _EqualKey,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hashtable; class hashtable;
template <class _Val, class _Key, class _HashFcn, template <class _Val, class _Key, class _HashFcn,
...@@ -470,7 +241,6 @@ public: ...@@ -470,7 +241,6 @@ public:
private: private:
typedef _Hashtable_node<_Val> _Node; typedef _Hashtable_node<_Val> _Node;
#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
public: public:
typedef typename _Alloc::template rebind<_Val>::other allocator_type; typedef typename _Alloc::template rebind<_Val>::other allocator_type;
allocator_type get_allocator() const { return _M_node_allocator; } allocator_type get_allocator() const { return _M_node_allocator; }
...@@ -478,19 +248,6 @@ private: ...@@ -478,19 +248,6 @@ private:
typedef typename _Alloc::template rebind<_Node>::other _M_node_allocator_type; typedef typename _Alloc::template rebind<_Node>::other _M_node_allocator_type;
typedef typename _Alloc::template rebind<_Node*>::other _M_node_ptr_allocator_type; typedef typename _Alloc::template rebind<_Node*>::other _M_node_ptr_allocator_type;
typedef std::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type; typedef std::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type;
#else
public:
typedef hash_allocator<_Val, _Alloc> allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
private:
typedef hash_allocator<_Node, _Alloc> _M_node_allocator_type;
# if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
typedef hash_allocator<_Node*, _Alloc> _M_node_ptr_allocator_type;
# else
typedef _Alloc _M_node_ptr_allocator_type;
# endif
typedef std::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type;
#endif
private: private:
_M_node_allocator_type _M_node_allocator; _M_node_allocator_type _M_node_allocator;
...@@ -525,7 +282,7 @@ public: ...@@ -525,7 +282,7 @@ public:
_M_hash(__hf), _M_hash(__hf),
_M_equals(__eql), _M_equals(__eql),
_M_get_key(__ext), _M_get_key(__ext),
@KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a), _M_buckets(__a),
_M_num_elements(0) _M_num_elements(0)
{ {
_M_initialize_buckets(__n); _M_initialize_buckets(__n);
...@@ -539,7 +296,7 @@ public: ...@@ -539,7 +296,7 @@ public:
_M_hash(__hf), _M_hash(__hf),
_M_equals(__eql), _M_equals(__eql),
_M_get_key(_ExtractKey()), _M_get_key(_ExtractKey()),
@KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a), _M_buckets(__a),
_M_num_elements(0) _M_num_elements(0)
{ {
_M_initialize_buckets(__n); _M_initialize_buckets(__n);
...@@ -550,7 +307,7 @@ public: ...@@ -550,7 +307,7 @@ public:
_M_hash(__ht._M_hash), _M_hash(__ht._M_hash),
_M_equals(__ht._M_equals), _M_equals(__ht._M_equals),
_M_get_key(__ht._M_get_key), _M_get_key(__ht._M_get_key),
@KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__ht.get_allocator()), _M_buckets(__ht.get_allocator()),
_M_num_elements(0) _M_num_elements(0)
{ {
_M_copy_from(__ht); _M_copy_from(__ht);
...@@ -636,30 +393,19 @@ public: ...@@ -636,30 +393,19 @@ public:
std::pair<iterator, bool> insert_unique_noresize(const value_type& __obj); std::pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
iterator insert_equal_noresize(const value_type& __obj); iterator insert_equal_noresize(const value_type& __obj);
#if @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS #if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
# define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \
typename std::iterator_traits< T >::iterator_category()
#elif @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY
# define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \
std::iterator_category( I )
#elif @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY
# define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \
std::__iterator_category( I )
#endif
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES && defined(@KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY)
template <class _InputIterator> template <class _InputIterator>
void insert_unique(_InputIterator __f, _InputIterator __l) void insert_unique(_InputIterator __f, _InputIterator __l)
{ {
insert_unique(__f, __l, insert_unique(__f, __l,
@KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(_InputIterator, __f)); typename std::iterator_traits<_InputIterator>::iterator_category());
} }
template <class _InputIterator> template <class _InputIterator>
void insert_equal(_InputIterator __f, _InputIterator __l) void insert_equal(_InputIterator __f, _InputIterator __l)
{ {
insert_equal(__f, __l, insert_equal(__f, __l,
@KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(_InputIterator, __f)); typename std::iterator_traits<_InputIterator>::iterator_category());
} }
template <class _InputIterator> template <class _InputIterator>
...@@ -1164,8 +910,8 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ...@@ -1164,8 +910,8 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
const size_type __n = _M_next_size(__num_elements_hint); const size_type __n = _M_next_size(__num_elements_hint);
if (__n > __old_n) { if (__n > __old_n) {
_M_buckets_type __tmp( _M_buckets_type __tmp(
__n, (_Node*)(0) __n, (_Node*)(0),
@KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(_M_buckets)); _M_buckets.get_allocator());
try { try {
for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) { for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
_Node* __first = _M_buckets[__bucket]; _Node* __first = _M_buckets[__bucket];
......
...@@ -101,87 +101,6 @@ int main() ...@@ -101,87 +101,6 @@ int main()
} }
#endif #endif
#ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
#include <iterator>
#include <list>
void f(std::iterator_traits<std::list<int>::iterator>::iterator_category const&) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
#include <iterator>
#include <list>
void f(std::list<int>::iterator x) { std::iterator_category(x); }
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
#include <iterator>
#include <list>
void f(std::list<int>::iterator x) { std::__iterator_category(x); }
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
#include <memory>
template <class Alloc>
void f(const Alloc&)
{
typedef typename Alloc::size_type alloc_size_type;
}
int main()
{
f(std::allocator<char>());
return 0;
}
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
#include <memory>
void f(std::allocator::size_type const&) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
#include <memory>
template <class T, class Alloc>
void f(const T&, const Alloc&)
{
typedef typename Alloc::template rebind<T>::other alloc_type;
}
int main()
{
f(0, std::allocator<char>());
return 0;
}
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
#include <memory>
void f(std::allocator<char> const& a)
{
a.max_size(sizeof(int));
}
int main()
{
f(std::allocator<char>());
return 0;
}
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
#include <vector>
void f(std::vector<int> const& v1)
{
std::vector<int>(1, 1, v1.get_allocator());
}
int main()
{
f(std::vector<int>());
return 0;
}
#endif
#ifdef TEST_KWSYS_STAT_HAS_ST_MTIM #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment