[Boost-bugs] [Boost C++ Libraries] #5254: hash template specializations require BOOST_HAS_TR1_HASH work-around

Subject: [Boost-bugs] [Boost C++ Libraries] #5254: hash template specializations require BOOST_HAS_TR1_HASH work-around
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-03-02 13:37:10


#5254: hash template specializations require BOOST_HAS_TR1_HASH work-around
-------------------------------------------+--------------------------------
 Reporter: Jim Bell <jim@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: Boost 1.47.0 | Component: TR1
  Version: Boost Development Trunk | Severity: Problem
 Keywords: TR1 hash mingw-gcc-4.4 msvc-8 |
-------------------------------------------+--------------------------------
 The TR1 docs show the templated hash struct being in namespace std::tr1.

 But putting a hash template specialization in std::tr1 doesn't work, at
 least in cases where BOOST_HAS_TR1_HASH isn't defined.

 This is broken for both MinGW-gcc-4.4 and MSVC-8 (VS2005).

 See the attached files:
 * TR1_hash_break.cpp doesn't compile for either platform.
 * TR1_hash_workaround.cpp compiles for both.


 ----
 MSVC-8:
 Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for
 80x86

 Copyright (C) Microsoft Corporation. All rights reserved.

 TR1_hash_break.cpp
 TR1_hash_break.cpp(21) : error C2888: 'boost::hash<my_key>' : symbol
 cannot be defined within namespace 'tr1'


 ----
 MinGW gcc-4.4:
 TR1_hash_break.cpp:17: error: specialization of 'template<class T> struct
 boost::hash' in different namespace
 F:\boost\MinGW-32\trunk\boost/boost/tr1/functional.hpp:127: error: from
 definition of 'template<class T> struct boost::hash'
 TR1_hash_break.cpp:19: error: definition of 'size_t
 boost::hash<my_key>::operator()(const my_key&) const' is not in namespace
 enclosing 'boost::hash<my_key>'

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5254>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC