std::regex 是否保证了最坏情况下的时间复杂度?
Does std::regex guaranttee the time-complexity in worst cases?
C++标准 [30.5.3
, n4830 ] 定义了std::error_complexity
,以指示正则表达式模式可能太复杂而无法完成。
我只是想知道:
std::regex 是否保证了最坏情况下的时间复杂度?
它似乎确实考虑了时间复杂度,但我怀疑它是否基于任何理论上的最坏或最佳情况假设; 它应该可能基于一些相对超过一定时间量的权衡,这里称为pre-set level
:
/** * 尝试与常规比赛的复杂性 表达式超出预设水平。 */
参考
/** The expression contained an invalid collating element name. */
constexpr error_type error_collate(_S_error_collate);
/** The expression contained an invalid character class name. */
constexpr error_type error_ctype(_S_error_ctype);
/**
* The expression contained an invalid escaped character, or a trailing
* escape.
*/
constexpr error_type error_escape(_S_error_escape);
/** The expression contained an invalid back reference. */
constexpr error_type error_backref(_S_error_backref);
/** The expression contained mismatched [ and ]. */
constexpr error_type error_brack(_S_error_brack);
/** The expression contained mismatched ( and ). */
constexpr error_type error_paren(_S_error_paren);
/** The expression contained mismatched { and } */
constexpr error_type error_brace(_S_error_brace);
/** The expression contained an invalid range in a {} expression. */
constexpr error_type error_badbrace(_S_error_badbrace);
/**
* The expression contained an invalid character range,
* such as [b-a] in most encodings.
*/
constexpr error_type error_range(_S_error_range);
/**
* There was insufficient memory to convert the expression into a
* finite state machine.
*/
constexpr error_type error_space(_S_error_space);
/**
* One of <em>*?+{</em> was not preceded by a valid regular expression.
*/
constexpr error_type error_badrepeat(_S_error_badrepeat);
/**
* The complexity of an attempted match against a regular expression
* exceeded a pre-set level.
*/
constexpr error_type error_complexity(_S_error_complexity);
/**
* There was insufficient memory to determine whether the
* regular expression could match the specified character sequence.
*/
constexpr error_type error_stack(_S_error_stack);
相关文章:
- 将树节点添加到向量向量中的 n 元树遍历的平均和最坏情况时间复杂度是多少?
- C++ - 最坏情况和平均情况插入时间复杂度在 std::unordered_map <int,int>?
- 有没有一种惯用的方法可以在不存储变换或不必要地重新计算的情况下找到数组变换的最小/最大值?
- 在不进行排序的情况下查找数组中n个最小值的索引
- 在最坏的情况下试验快速排序.它运行良好,但在最坏的情况下发生未知错误.我想
- std::regex 是否保证了最坏情况下的时间复杂度?
- 在没有额外代码的情况下链接两个独立类的最通用方法是什么?
- 使用c 中的sort()函数对字符串进行排序的最坏情况是什么是什么
- 如何在 c++ 中有效使用容器的情况下打印 5 个值的最大索引
- 在没有比较运算符的情况下查找 2 个数字之间的最小值
- 如何在不进行多次通过(C )的情况下找到最小的所有元素
- 获取当前目录,我可以在不知道最大缓冲区大小的情况下进行
- 如何在不删除任何字符的情况下将字符从字符串中的某个位置移动到其最前面
- 在给定某些约束的情况下,求出元素之间的最大距离
- 为什么在这种情况下不调用最合适的构造函数?
- 如何在不使用min_element C++的情况下找到向量中的最小值和最大值<double>
- 在最坏的情况下,多少QPI延迟可以减慢任意应用程序的速度
- 在实时应用程序中最坏情况下执行的最快c++映射
- 为什么在最坏的情况下unorder_set重哈希复杂度可能是O(n^2)
- 为什么c++程序要为局部变量分配比在最坏情况下需要的更多的内存?