On Mar 3, 5:34 pm, "Bo Persson" <b...@gmb.dk> wrote:
In your case, I believe there is a workaround in using a pointer to
function in place of the function itself. Hardly worth stopping the
release while waiting for the real fix.
let me just point out that we have some cases where there's actually
_no_ workaround:
surely you can cast/store the function pointer, but this implies
that you know the exact function signature, which defeats the
original purpose of the example.
here's the shortest real usage case I was able to assemble: when you
erase an element from a container, but need to keep the iterator
valid, depending on the container you'd write i=c.erase(i) or
c.erase(i ++).
in our library we have these lines somewhere:
template <typename container_t, typename iterator_t, typename
base_t> inline void erase_gap2(container_t& c, iterator_t& i,
iterator_t (base_t::*)(iterator_t))
{
i = c.erase(i);
}
template <typename container_t, typename iterator_t, typename
base_t> inline void erase_gap2(container_t& c, iterator_t& i, void
(base_t::*) (iterator_t))
{
c.erase(i++);
}
template <typename container_t>
inline void erase_gap(container_t& c, typename
container_t::iterator& i)
{
erase_gap2(c, i, &container_t::erase);
}
this example is not 100% relevant, because erase is not overloaded
with iterator&&, so it will work (well... I think...) even in
VC2010. however it's impossible to put an explicit cast around
cont::erase.
ok.