C++ 正在引发std::超出\u范围异常&引用;预期的类型说明符";

C++ 正在引发std::超出\u范围异常&引用;预期的类型说明符";,c++,exception,exception-handling,std,C++,Exception,Exception Handling,Std,我正在创建一个应该是非常糟糕的字符串的类,但是我在at方法中遇到了这个问题 MyString.h char at(unsigned int i) const throw(std::out_of_range); char& at(unsigned int i) throw(std::out_of_range); MyString.cpp char MyString::at(unsigned int i) const throw(std::out_of_range) { if (m

我正在创建一个应该是非常糟糕的
字符串的类,但是我在
at
方法中遇到了这个问题

MyString.h

char at(unsigned int i) const throw(std::out_of_range);
char& at(unsigned int i) throw(std::out_of_range);
MyString.cpp

char MyString::at(unsigned int i) const throw(std::out_of_range) {
    if (mylength_ == 0 || i < 0 || i > mylength_ - 1)
        throw std::out_of_range("nopenope");
    return string_[i];
}

char& MyString::at(unsigned int i) throw(std::out_of_range) {
    if (mylength_ == 0 || i < 0 || i > mylength_ - 1)
        throw std::out_of_range("nopenope");
    return string_[i];
}
char MyString::at(unsigned int i)常量抛出(std::out_of_range){
if(mylength_==0 | | i<0 | | i>mylength_-1)
抛出std::超出范围(“NOPEPOE”);
返回字符串_ui];
}
char&MyString::at(unsigned int i)throw(std::out_of_range){
if(mylength_==0 | | i<0 | | i>mylength_-1)
抛出std::超出范围(“NOPEPOE”);
返回字符串_ui];
}

您似乎没有包括标题

在哪一行收到此消息?您是否包含stdexcept?与无符号int相比,您更喜欢std::size\u t