本文整理汇总了C++中state_type::bos方法的典型用法代码示例。如果您正苦于以下问题:C++ state_type::bos方法的具体用法?C++ state_type::bos怎么用?C++ state_type::bos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类state_type
的用法示例。
在下文中一共展示了state_type::bos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
bool operator ()(state_type<BidiIter> &state) const
{
if(state.bos() && state.flags_.match_bol_)
{
return true;
}
BidiIter cur = state.cur_;
BidiIter const end = state.end_;
std::advance(cur, static_cast<diff_type>(-!state.bos()));
for(; cur != end; ++cur)
{
if(this->bits_[static_cast<unsigned char>(*cur)])
{
state.cur_ = ++cur;
return true;
}
}
return false;
}
示例2: if
inline bool regex_search_impl
(
state_type<BidiIter> &state
, basic_regex<BidiIter> const &re
, bool not_initial_null = false
)
{
typedef core_access<BidiIter> access;
typedef typename iterator_value<BidiIter>::type char_type;
match_results<BidiIter> &what = *state.context_.results_ptr_;
// an invlid regex matches nothing
if(!access::invalid(re))
{
bool const partial_ok = state.flags_.match_partial_;
save_restore<bool> not_null(state.flags_.match_not_null_, state.flags_.match_not_null_ || not_initial_null);
state.flags_.match_prev_avail_ = state.flags_.match_prev_avail_ || !state.bos();
regex_impl<BidiIter> const &impl = *access::get_regex_impl(re);
BidiIter const begin = state.cur_, end = state.end_;
BidiIter &sub0begin = state.sub_match(0).begin_;
sub0begin = state.cur_;
// If match_continuous is set, we only need to check for a match at the current position
if(state.flags_.match_continuous_)
{
if(access::match(re, state))
{
access::set_prefix_suffix(what, begin, end);
return true;
}
// handle partial matches
else if(partial_ok && state.found_partial_match_)
{
state.set_partial_match();
return true;
}
}
// If we have a finder, use it to find where a potential match can start
else if(impl.finder_)
{
finder<BidiIter> const &find = *impl.finder_;
if(find(state))
{
if(state.cur_ != begin)
{
not_null.restore();
}
do
{
sub0begin = state.cur_;
if(access::match(re, state))
{
access::set_prefix_suffix(what, begin, end);
return true;
}
// handle partial matches
else if(partial_ok && state.found_partial_match_)
{
state.set_partial_match();
return true;
}
BOOST_ASSERT(state.cur_ == sub0begin);
not_null.restore();
}
while(state.cur_ != state.end_ && (++state.cur_, find(state)));
}
}
// Otherwise, use brute force search at every position.
else
{
for(;;)
{
if(access::match(re, state))
{
access::set_prefix_suffix(what, begin, end);
return true;
}
// handle partial matches
else if(partial_ok && state.found_partial_match_)
{
state.set_partial_match();
return true;
}
else if(end == sub0begin)
{
break;
}
BOOST_ASSERT(state.cur_ == sub0begin);
state.cur_ = ++sub0begin;
not_null.restore();
//.........这里部分代码省略.........
示例3: match
static bool match(state_type<BidiIter> &state, Next const &next)
{
return state.bos() && next.match(state);
}