Boost logo

Boost :

From: Daniel James (daniel_at_[hidden])
Date: 2004-11-18 10:54:50


Daniel James wrote:
> Jonathan Wakely wrote:
>
>> In fact, I get a similar error for the example code in your mail:
>>
>> overloaded.cc: In member function `ResultType
>> GENERATE_DETAIL::foo_overloaded_t<ResultType>::operator()() const':
>> overloaded.cc:7: error: no matching function for call to `foo()'
>> overloaded.cc:4: note: candidates are: void foo(int)
>> overloaded.cc:5: note: void foo(char*)
>>
>> So although I can see uses for this, I can't use it :-)
>
> Oh dear. I hadn't tested it very thoroughly - it works on g++ versions
> 2.95 and 3.3, but not 3.4 (which I guess you're using).

And intel fails in strict mode as well. I've attached a quickly fixed
version, which doesn't support nullary functions. I've also changed the
interface to specify the object's name so that you can call
'std::tolower'.

Your example now becomes:

      #include "overloaded.hpp"
      #include <string>
      #include <algorithm>
      #include <cctype>

      GENERATE_OVERLOADED(int, std::tolower, tolower_overloaded)

      int main()
      {
          std::string s("FNORD");
          std::transform(s.begin(), s.end(), s.begin(),
                  tolower_overloaded);
      }

Which seems to work okay, and is probably a little better.

Thanks for the feedback,

Daniel




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