◐ Shell
clean mode source ↗

std::bad_function_call - cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Definido no cabeçalho

<functional>

class bad_function_call;

(desde C++11)

std::bad_function_call is the type of the exception thrown by std::function::operator() if the function wrapper has no target.

cpp/error/exception

Inheritance diagram

Funções de membro

bad_function_call()
(função pública membro)

std::bad_function_call::bad_function_call()

<tbody> </tbody>

Constructs a new instance of std::bad_function_call.

Parameters

(none)

Exceptions

Herdado de std::exception

Member functions

destrói o objeto de exceção

Original:

destructs the exception object

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(of std::exception função pública virtual membro) [edit]

retorna uma cadeia explicativa

Original:

returns an explanatory string

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(of std::exception função pública virtual membro) [edit]

Exemplo

#include <iostream>
#include <functional>

int main()
{
    std::function<int()> f = nullptr;
    try {
        f();
    } catch(const std::bad_function_call& e) {
        std::cout << e.what() << '\n';
    }
}

Saída:

Veja também

envolve objeto que pode ser chamado de qualquer tipo com a assinatura especificada função chamada

Original:

wraps callable object of any type with specified function call signature

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(modelo de classe) [edit]