summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qoverload.qdoc
blob: 3e1744ea070c81f125e1282a41c3885c09c151f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*! \fn template <typename T> auto qOverload(T functionPointer)
    \relates <QOverload>
    \since 5.7

    Returns a pointer to an overloaded function. The template
    parameter is the list of the argument types of the function.
    \a functionPointer is the pointer to the (member) function:

    \snippet code/src_corelib_global_qglobal.cpp 52

    If a member function is also const-overloaded \l qConstOverload and
    \l qNonConstOverload need to be used.

    qOverload() requires C++14 enabled. In C++11-only code, the helper
    classes QOverload, QConstOverload, and QNonConstOverload can be used directly:

    \snippet code/src_corelib_global_qglobal.cpp 53

    \note Qt detects the necessary C++14 compiler support by way of the feature
    test recommendations from
    \l{https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations}
    {C++ Committee's Standing Document 6}.

    \sa qConstOverload(), qNonConstOverload(), {Differences between String-Based
    and Functor-Based Connections}
*/

/*! \fn template <typename T> auto qConstOverload(T memberFunctionPointer)
    \relates <QOverload>
    \since 5.7

    Returns the \a memberFunctionPointer pointer to a constant member function:

    \snippet code/src_corelib_global_qglobal.cpp 54

    \sa qOverload, qNonConstOverload, {Differences between String-Based
    and Functor-Based Connections}
*/

/*! \fn template <typename T> auto qNonConstOverload(T memberFunctionPointer)
    \relates <QOverload>
    \since 5.7

    Returns the \a memberFunctionPointer pointer to a non-constant member function:

    \snippet code/src_corelib_global_qglobal.cpp 54

    \sa qOverload, qNonConstOverload, {Differences between String-Based
    and Functor-Based Connections}
*/