这个语句 std::__throw_out_of_range(__N("array::at")) 中的 __N() 是什么?
What is __N() in this statement std::__throw_out_of_range(__N("array::at"))?
我正在查看 array 头文件中 at()
函数的定义以消除一些疑问。这是定义-
reference //typedef for &value_type of array
at(size_type __n) //size_type is typedef for size_t
{
if (__n >= _Nm) //_Nm is typedef for size of array
std::__throw_out_of_range(__N("array::at")); //what is __N(...) ?
return _M_instance[__n]; //_M_instance[...] is variable of type std::array
}
那么,最后第三行的 N(...)
是什么?或者更具体地说,它有什么作用?
// This marks string literals in header files to be extracted for eventual
// translation. It is primarily used for messages in thrown exceptions; see
// src/functexcept.cc. We use __N because the more traditional _N is used
// for something else under certain OSes (see BADNAMES).
#define __N(msgid) (msgid)
我正在查看 array 头文件中 at()
函数的定义以消除一些疑问。这是定义-
reference //typedef for &value_type of array
at(size_type __n) //size_type is typedef for size_t
{
if (__n >= _Nm) //_Nm is typedef for size of array
std::__throw_out_of_range(__N("array::at")); //what is __N(...) ?
return _M_instance[__n]; //_M_instance[...] is variable of type std::array
}
那么,最后第三行的 N(...)
是什么?或者更具体地说,它有什么作用?
// This marks string literals in header files to be extracted for eventual
// translation. It is primarily used for messages in thrown exceptions; see
// src/functexcept.cc. We use __N because the more traditional _N is used
// for something else under certain OSes (see BADNAMES).
#define __N(msgid) (msgid)