Boost logo

Boost Users :

Subject: [Boost-users] [mem_fn] Ambiguous call to mem_fn with stdcall function
From: Conrad Scott (conrad.scott_at_[hidden])
Date: 2009-03-07 09:43:49


I'm trying to use g++ (and MinGW) to compile a win32 Direct3X program
that I've written under Visual C++. All is well (so far) except for one
thing.

I'm using the technique suggested in the Boost shared_ptr documentation
to store pointers to COM objects, which works fine under Visual C++ but
under g++ (either 3.4.x or 4.3.x) I get errors about the call to mem_fn
being ambiguous due to stdcall / non-stdcall overloading.

I can't find any references to this problem on the net so I assume I'm
doing something utterly boneheaded. Any hints would be very welcome.

For example:

#define BOOST_MEM_FN_ENABLE_STDCALL

#include <d3d9.h>

#include <boost/mem_fn.hpp>
#include <boost/shared_ptr.hpp>

void test_mem_fn(IDirect3DDevice9 * const device)
{
   boost::shared_ptr<IDirect3DDevice9> ptr(
      device,
      boost::mem_fn(&IDirect3DDevice9::Release) );
}

test/test_mem_fn.cpp:13: error:
call of overloaded 'mem_fn(ULONG (IDirect3DDevice9::*)())' is ambiguous

C:/Boost/include/boost-1_38/boost/bind/mem_fn_cc.hpp:15:
note: candidates are: boost::_mfi::mf0<R, T> boost::mem_fn(R (T::*)())
[with R = ULONG, T = IDirect3DDevice9]

C:/Boost/include/boost-1_38/boost/bind/mem_fn_cc.hpp:15:
note: boost::_mfi::mf0_stdcall<R, T> boost::mem_fn(R (T::*)())
[with R = ULONG, T = IDirect3DDevice9]

C:/Boost/include/boost-1_38/boost/mem_fn.hpp:382:
note: boost::_mfi::dm<R, T> boost::mem_fn(R T::*)
[with R = ULONG ()(), T = IDirect3DDevice9]

Many thanks,
Conrad


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