Image

Imagebik_top wrote in Imageru_cpp

Почему не работает ADL?

Разбираюсь с Boost.Any.
Не могу понять, почему не компилируется след. код:
// Test.cpp

#include <boost/any.hpp>

#include <iostream>
#include <cstdlib>

int main()
{
  struct Waiter { ~Waiter() { std::system("PAUSE"); } } waiter;

  unsigned char x = 123;
  boost::any const a(( int(x) ));
  if (int const* const p = /*boost::*/any_cast<int const>(&a))
    std::cout << *p << std::endl;

  return EXIT_SUCCESS;
}


MSVC и MinGW ругаются на отсутствие квалификации «boost::»:
«any_cast' : undeclared identifier». Но ведь поиск Кёнига ещё никто не отменял?

Или для шаблонов функций правила другие?