- system_error[meta header]
- std[meta namespace]
- function template[meta id-type]
- cpp11[meta cpp]
namespace std {
template <class charT, class traits>
std::basic_ostream<charT,traits>&
operator<<(std::basic_ostream<charT,traits>& os, const error_code& ec);
}
左辺のbasic_ostream
オブジェクトにerror_code
オブジェクトを出力する
os << ec.category().name() << ':' << ec.value();
- category()[link category.md]
- name()[link /reference/system_error/error_category/name.md]
- value()[link value.md]
os
#include <iostream>
#include <system_error>
int main()
{
std::error_code ec = std::make_error_code(std::errc::invalid_argument);
std::cout << ec << std::endl;
}
- std::make_error_code[link /reference/system_error/make_error_code.md]
- std::errc::invalid_argument[link /reference/system_error/errc.md]
generic:22
- C++11
- Clang: ??
- GCC:
- GCC, C++11 mode: 4.7.0
- ICC: ??
- Visual C++: 2010