Boost logo

Boost :

Subject: [boost] [unordered] error: template argument required for ‘struct set_extractor’
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2010-10-06 11:00:38


Hi,

I'm experiencing strange problem with unordered_map.hpp file.
I'm using Boost 1.44 with GCC 4.2.1 from XCode on Mac OS X.
Compiling simple test:

$ cat foo.cpp
#include <boost/unordered_map.hpp>
int main() {}

$ g++ -o foo.o foo.cpp
In file included from
/usr/local/include/boost/unordered/detail/equivalent.hpp:11,
                  from
/usr/local/include/boost/unordered/unordered_map.hpp:19,
                  from /usr/local/include/boost/unordered_map.hpp:16,
                  from foo.cpp:1:
/usr/local/include/boost/unordered/detail/extract_key.hpp:31: error:
template argument required for ‘struct set_extractor’
/usr/local/include/boost/unordered/detail/extract_key.hpp:77: error:
template argument required for ‘struct map_extractor’

I've looked at the preprocessed file and there is something that
disturbs me - templates of set_extractor and map_extractor are getting
"changed".

Comparing preprocessed file against source from
boost/unordered/detail/extract_key.hpp I see

1) set_extractor

a) original code

     template <class ValueType>
     struct set_extractor
     {
         typedef ValueType value_type;
         typedef ValueType key_type;

b) preprocessed output

     struct set_extractor
     {
         template <class ValueType>
         struct apply
         {
             typedef ValueType value_type;
             typedef ValueType key_type;

2) map_extractor

a) original code

     template <class Key, class ValueType>
     struct map_extractor
     {
         typedef ValueType value_type;
         typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Key>::type
key_type;

b) preprocessed output

     struct map_extractor
     {
         template <class ValueType>
         struct apply
         {
             typedef ValueType value_type;
             typedef typename
                 remove_const<typename ValueType::first_type>::type
                 key_type;

As you can see, the set_exctractor and map_exctractor templates
have lost template parameters declarations and some extra
nested struct has been generated:

template <class ValueType>
struct apply

Folks on #boost at IRC suggested it may be caused by MPL magic.

I haven't noticed any such problem with GCC 4.4 on Linux with Boost 1.43
There has been similar issue reported, but the problem was ALLOC macro
defined by RICE library, what rather is not my case:

http://lists.boost.org/boost-users/2010/05/59340.php

Does anyone have an idea what's happening?

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk