Форум программистов, компьютерный форум CyberForum.ru
Наши страницы

Перегрузка функции - C++

Войти
Регистрация
Восстановить пароль
Другие темы раздела
C++ Ошибка в двусвязном списке http://www.cyberforum.ru/cpp-beginners/thread815602.html
Задача - сделать очередь с приоритетным исключением на основе двухсвязного списка. Проблема в том, что элементы не всегда становяться по приоритету. Подскажите, пожалуйста, в чем ошибка. struct...
C++ Что получится из кода Необходимо описать результат выполнения программы: 1) 2) 3) 4) 5) http://www.cyberforum.ru/cpp-beginners/thread815601.html
C++ написать программу перевода введенного символа
написать программу перевода введенного символа от a до f в верхний регистр, а другие символы заменять на Z
C++ Написать программу проверки попадания введенного числа в диапазон
написать программу проверки попадания введенного числа в диапазон от -6 до -2
C++ 2 символа s2 последние и средние 3 символа s1 - соединить http://www.cyberforum.ru/cpp-beginners/thread815571.html
Помогите пожалуйста! Ввести строки s1 и s2. Последние 2 символа s2 и средние 3 символа s1 - соединить. В полученной строке посчитать количество "1". Выводить на екран монитора: -введенные...
C++ Как изменить размер главного окна в visual studio 2005? Как изменить размер главного окна в visual studio 2005? подробнее

Показать сообщение отдельно
Kastaneda
Форумчанин
Эксперт С++
4655 / 2863 / 228
Регистрация: 12.12.2009
Сообщений: 7,275
Записей в блоге: 2
Завершенные тесты: 1
23.03.2013, 14:47
Ну мне со своим скудным английским все же кажется, что ADL так или иначе связан с namespace'ами (точнее с областью видимости) и в выборе перегруженной ф-ции не учавствует.
Кликните здесь для просмотра всего текста
3.4.2 Argument-dependent name lookup [basic.lookup.argdep]
1 When the postfix-expression in a function call (5.2.2) is an unqualified-id , other namespaces not considered
during the usual unqualified lookup (3.4.1) may be searched, and in those namespaces, namespace-scope
friend function declarations (11.4) not otherwise visible may be found. These modifications to the search
depend on the types of the arguments (and for template template arguments, the namespace of the template
argument). [ Example:
namespace N {
struct S { };
void f(S);
}
void g() {
N::S s;
f(s); // OK: calls N::f
(f)(s); // error: N::f not considered; parentheses
// prevent argument-dependent lookup
}
—end example ]
2 For each argument type T in the function call, there is a set of zero or more associated namespaces and a
set of zero or more associated classes to be considered. The sets of namespaces and classes is determined
entirely by the types of the function arguments (and the namespace of any template template argument).
Typedef names and using-declarations used to specify the types do not contribute to this set. The sets of
namespaces and classes are determined in the following way:
— If T is a fundamental type, its associated sets of namespaces and classes are both empty.
— If T is a class type (including unions), its associated classes are: the class itself; the class of which it is a
member, if any; and its direct and indirect base classes. Its associated namespaces are the namespaces
of which its associated classes are members. Furthermore, if T is a class template specialization,
its associated namespaces and classes also include: the namespaces and classes associated with the
types of the template arguments provided for template type parameters (excluding template template
parameters); the namespaces of which any template template arguments are members; and the classes
of which any member templates used as template template arguments are members. [ Note: non-type
template arguments do not contribute to the set of associated namespaces. —end note ]
— If T is an enumeration type, its associated namespace is the namespace in which it is defined. If it is
class member, its associated class is the member’s class; else it has no associated class.
§ 3.4.2 47
c
ISO/IEC N3126=10-0116
— If T is a pointer to U or an array of U, its associated namespaces and classes are those associated with
U.
— If T is a function type, its associated namespaces and classes are those associated with the function
parameter types and those associated with the return type.
— If T is a pointer to a member function of a class X, its associated namespaces and classes are those
associated with the function parameter types and return type, together with those associated with X.
— If T is a pointer to a data member of class X, its associated namespaces and classes are those associated
with the member type together with those associated with X.
If an associated namespace is an inline namespace (7.3.1), its enclosing namespace is also included in the set.
If an associated namespace directly contains inline namespaces, those inline namespaces are also included in
the set. In addition, if the argument is the name or address of a set of overloaded functions and/or function
templates, its associated classes and namespaces are the union of those associated with each of the members
of the set, i.e., the classes and namespaces associated with its (non-dependent) parameter types and return
type.
3 Let X be the lookup set produced by unqualified lookup (3.4.1) and let Y be the lookup set produced by
argument dependent lookup (defined as follows). If X contains
— a declaration of a class member, or
— a block-scope function declaration that is not a using-declaration, or
— a declaration that is neither a function or a function template
then Y is empty. Otherwise Y is the set of declarations found in the namespaces associated with the
argument types as described below. The set of declarations found by the lookup of the name is the union of
X and Y . [ Note: the namespaces and classes associated with the argument types can include namespaces
and classes already considered by the ordinary unqualified lookup. —end note ] [ Example:
namespace NS {
class T { };
void f(T);
void g(T, int);
}
NS::T parm;
void g(NS::T, float);
int main() {
f(parm); // OK: calls NS::f
extern void g(NS::T, float);
g(parm, 1); // OK: calls g(NS::T, float)
}
—end example ]
4 When considering an associated namespace, the lookup is the same as the lookup performed when the
associated namespace is used as a qualifier (3.4.3.2) except that:
— Any using-directives in the associated namespace are ignored.
— Any namespace-scope friend functions or friend function templates declared in associated classes are
visible within their respective namespaces even if they are not visible during an ordinary lookup (11.4).
— All names except those of (possibly overloaded) functions and function templates are ignored.
0
 
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Рейтинг@Mail.ru