Boost logo

Boost Users :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2007-03-15 09:42:26


Filip Konvi?ka ha escrito:

> >> I've been playing with the problem too, and found this solution...it
> >> does not rely on typeof, but it does rely on return_type. I'm a bit
> >> unsure about why I had to use "unsigned int" to make it work, so I'd
> >> welcome some comments on this.
> >>
> >
> > Do you mean you couldn't use RetType properly? I've tried with
> > the following in GCC 3.2:
> >
> > template<class T, typename MemberType, MemberType T::* MemberPtr,
> > typename RetType, RetType (MemberType::*MemberFct)() const>
> > struct extract_and_call {
> > typedef RetType result_type;
> > RetType operator()(T const& t) const {
> > return ((t .* MemberPtr) .* MemberFct)();
> > }
> > };
> >
> Aye, I got the following warning that I could not get rid of (VC 7.1)
>
> C:\Boost\include\boost-1_33_1\boost\functional\hash\hash.hpp(132) :
> warning C4267: 'argument' : conversion from 'size_t' to 'unsigned int',
> possible loss of data

[...]

Looks like an overzealous or simply misguided warning. Can you please
try the following?

  #include <boost/functional/hash/hash.hpp>
  #include <cstddef>

  int main()
  {
    std::size_t x=0;
    boost::hash<std::size_t>()(x);
  }

Same warning? If so, you might ask for inclusion of a suitable
#pragma warning(disable...) to the Boost.Hash author.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net