hash_multimap and concept checking
I've come across a problem with gcc 4.1.1, hash_multimap and concept
checking. The following code fails to compile when g++ is invoked as
g++ -D_GLIBCXX_CONCEPT_CHECKS concepts.cpp
and concepts.cpp is
#include <ext/hash_map>
namespace Sgi=::__gnu_cxx;
struct foo
{
const int i;
};
typedef Sgi::hash_multimap<int, foo> map_t;
int main()
{
map_t my_map;
}
The immediate reason is that <ext/hash_map> contains the lines:
template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
class _Alloc>
class hash_multimap
{
// concept requirements
__glibcxx_class_requires(_Key, _SGIAssignableConcept)
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
__glibcxx_class_requires3(_HashFcn, size_t, _Key,
_UnaryFunctionConcept)
__glibcxx_class_requires3(_EqualKey, _Key, _Key,
_BinaryPredicateConcept)
But I can see nothing in the SGI documentation, or in Matthew
Austern's 2001 WG21 hashtable proposal, implying that the data element
in a hash_multimap should be assignable. Using hash_map in lieu of
hash_multimap compiles fine: there are no equivalent concept checking
statements.
Is this Assignable requirement on Data, imposed by g++ 4.1.1, a
feature of the proposed standard hash_multimap?
--
Giles Chamberlin
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]