std::regex_error
来源:互联网 发布:苹果电脑系统备份软件 编辑:程序博客网 时间:2024/06/04 18:46
Regex exception
Objects of this exception type are thrown by the elements of the regex library.It inherits from the standard exception runtime_error, and has a special public member function, code, which returns a specific code of typeregex_constants::error_type depending on the kind of error that threw it:
Member functions
- explicit regex_error (regex_constants::error_type ecode);
- Constructs a regex exception with error codeecode.
- regex_constants::error_type code() const;
- Returns the error code with which it was constructed.
Example
123456789101112131415
// regex_error#include <iostream>#include <regex>int main (){ try { std::regex myregex ("*"); } catch (std::regex_error& e) { if (e.code() == std::regex_constants::error_badrepeat) std::cerr << "Repeat was not preceded by a valid regular expression.\n"; else std::cerr << "Some other regex exception happened.\n"; } return 0;}
Edit & Run
Output (stderr):
Repeat was not preceded by a valid regular expression.
See also
- regex_constants
- regex constants (namespace )
- exception
- Standard exception class (class )
- runtime_error
- Runtime error exception (class )
0 0
- std::regex_error
- std
- std
- std
- std::map&&std::set
- std::map & std::hash_map
- std::min std::max
- std::function std::bind
- std::function std::bind
- std::copy() & std::back_inserter()
- std::ref, std::cref
- std::mutex 、std::lock_guard
- std::set||std::deque||std::map
- C++ std::find, std::find_if, std::find_if_not
- 关于std:auto_ptr std:shared_ptr std:unique_ptr
- std::dec, std::hex, std::oct
- std::static_pointer_cast, std::dynamic_pointer_cast, std::const_pointer_cast
- std::find, std::find_if, std::find_if_not
- Android Launcher源码分析-网址
- Eclipse+超快的模拟器Genymotion开发Android应用(第一步:安装及配置Genymotion)
- 存储过程返回多个结果集处理
- 使用ssh无法连接虚拟机linux系统
- 批处理命令调用WINRAR对文件进行压缩
- std::regex_error
- 骑士斗恶龙
- Robotium针对只有apk包的测试入门例子
- ubuntu 启动流程
- apache ab 压力测试
- 磁盘快照技术
- Leetcode Container with Most Water
- Delphi Idhttp的get和post方法
- 二分查找小结