Template build issues.
This commit is contained in:
Родитель
3601789f8e
Коммит
775ed98a18
|
@ -247,7 +247,6 @@ namespace JavaScript {
|
|||
|
||||
Data &insert(Reference &r, Key key);
|
||||
Data &insert(Key key);
|
||||
Data &insert(Data data);
|
||||
void erase(Reference &r);
|
||||
void erase(Key key);
|
||||
Data *operator[](Key key);
|
||||
|
@ -265,6 +264,7 @@ namespace JavaScript {
|
|||
#ifndef _WIN32
|
||||
template<class Value> Data &insert(Key key, Value value);
|
||||
template<class Value> Data &insert(Reference &r, Key key, Value value);
|
||||
template<class Value> Data &insert(Data data);
|
||||
#else
|
||||
// Microsoft VC6 bug: VC6 doesn't allow this to be defined outside the
|
||||
// class
|
||||
|
@ -291,6 +291,14 @@ namespace JavaScript {
|
|||
return insert(r, key, value);
|
||||
}
|
||||
|
||||
template<class Value>
|
||||
Data &HashTable<Data, Key, H>::insert(Data data)
|
||||
{
|
||||
Key key = data.key();
|
||||
Value value = data.value();
|
||||
return insert(key, value);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
};
|
||||
|
@ -356,43 +364,46 @@ namespace JavaScript {
|
|||
#endif
|
||||
return e->data;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Insert the given key/value pair into the hash table. If an entry with a
|
||||
// matching key already exists, replace that entry's value.
|
||||
// Return a reference to the new entry's value.
|
||||
|
||||
// Microsoft VC6 bug: VC6 doesn't allow this to be defined outside the class
|
||||
template<class Data, class Key, class H> template<class Value>
|
||||
Data &HashTable<Data, Key, H>::insert(Key key, Value value)
|
||||
{
|
||||
Reference r(*this, key);
|
||||
if (r)
|
||||
return *r = value;
|
||||
else
|
||||
return insert(r, key, value);
|
||||
}
|
||||
|
||||
template<class Data, class Key, class H> template<class Value>
|
||||
Data &HashTable<Data, Key, H>::insert(Data data)
|
||||
{
|
||||
Key key = data.key();
|
||||
Value value = data.value();
|
||||
return insert(key, value);
|
||||
}
|
||||
#endif // !_WIN32
|
||||
|
||||
// Same as above but without a Value argument.
|
||||
template<class Data, class Key, class H>
|
||||
inline Data &HashTable<Data, Key, H>::insert(Reference &r, Key key)
|
||||
{
|
||||
ASSERT(r.ht == this && !r.entry);
|
||||
Entry *e = new Entry(r.keyHash, key);
|
||||
*r.backpointer = e;
|
||||
++nEntries;
|
||||
maybeGrow();
|
||||
#ifdef DEBUG
|
||||
--r.ht->nReferences;
|
||||
r.ht = 0;
|
||||
#endif
|
||||
return e->data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Insert the given key/value pair into the hash table. If an entry with a
|
||||
// matching key already exists, replace that entry's value.
|
||||
// Return a reference to the new entry's value.
|
||||
#ifndef _WIN32
|
||||
// Microsoft VC6 bug: VC6 doesn't allow this to be defined outside the class
|
||||
template<class Data, class Key, class H> template<class Value>
|
||||
Data &HashTable<Data, Key, H>::insert(Key key, Value value)
|
||||
{
|
||||
Reference r(*this, key);
|
||||
if (r)
|
||||
return *r = value;
|
||||
else
|
||||
return insert(r, key, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Same as above but without a Value argument.
|
||||
template<class Data, class Key, class H>
|
||||
inline Data &HashTable<Data, Key, H>::insert(Reference &r, Key key)
|
||||
{
|
||||
ASSERT(r.ht == this && !r.entry);
|
||||
Entry *e = new Entry(r.keyHash, key);
|
||||
*r.backpointer = e;
|
||||
++nEntries;
|
||||
maybeGrow();
|
||||
#ifdef DEBUG
|
||||
--r.ht->nReferences;
|
||||
r.ht = 0;
|
||||
#endif
|
||||
return e->data;
|
||||
}
|
||||
|
||||
template<class Data, class Key, class H>
|
||||
Data &HashTable<Data, Key, H>::insert(Key key)
|
||||
{
|
||||
|
@ -404,15 +415,6 @@ namespace JavaScript {
|
|||
}
|
||||
|
||||
|
||||
// Same as above but with just a Data argument.
|
||||
template<class Data, class Key, class H>
|
||||
Data &HashTable<Data, Key, H>::insert(Data data)
|
||||
{
|
||||
Key key = data.key();
|
||||
Value value = data.value();
|
||||
return insert(key, value);
|
||||
}
|
||||
|
||||
|
||||
// Reference r must point to an existing entry. Delete that entry.
|
||||
// The reference is not valid after this method is called.
|
||||
|
|
Загрузка…
Ссылка в новой задаче