本文整理汇总了C++中CWord::CyclicLeftShift方法的典型用法代码示例。如果您正苦于以下问题:C++ CWord::CyclicLeftShift方法的具体用法?C++ CWord::CyclicLeftShift怎么用?C++ CWord::CyclicLeftShift使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWord
的用法示例。
在下文中一共展示了CWord::CyclicLeftShift方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_tuple
std::tuple<unsigned short, unsigned short, unsigned short> LongestCommonSubwordCyclic(CWord u, CWord v) {
unsigned short max_common_prefix = 0;
unsigned short u_max_begin = u.size();
unsigned short v_max_begin = v.size();
for (unsigned short current_u_begin = 0; current_u_begin < u.size(); ++current_u_begin) {
for (unsigned short current_v_begin = 0; current_v_begin < v.size(); ++current_v_begin) {
auto u_copy = u;
auto v_copy = v;
unsigned short current_common_prefix_length = 0;
while (u_copy.GetFront() == v_copy.GetFront()) {
++current_common_prefix_length;
u_copy.PopFront();
if (u_copy.Empty()) {
break;
}
v_copy.PopFront();
if (v_copy.Empty()) {
break;
}
}
if (current_common_prefix_length > max_common_prefix) {
u_max_begin = current_u_begin;
v_max_begin = current_v_begin;
max_common_prefix = current_common_prefix_length;
}
v.CyclicLeftShift();
}
u.CyclicLeftShift();
}
return std::make_tuple(u_max_begin, v_max_begin, max_common_prefix);
}