本文整理汇总了C++中boost::next方法的典型用法代码示例。如果您正苦于以下问题:C++ boost::next方法的具体用法?C++ boost::next怎么用?C++ boost::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost
的用法示例。
在下文中一共展示了boost::next方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_type
virtual const std::string do_type() const throw ()
{
//
// A real application should use OS facilities for this. This
// is a crude hack because sdl-viewer uses std::filebuf in
// order to remain simple and portable.
//
using std::find;
using std::string;
using boost::algorithm::iequals;
using boost::next;
string media_type = "application/octet-stream";
const string::const_reverse_iterator dot_pos =
find(this->url_.rbegin(), this->url_.rend(), '.');
if (dot_pos == this->url_.rend()
|| next(dot_pos.base()) == this->url_.end()) {
return media_type;
}
const string::const_iterator hash_pos =
find(next(dot_pos.base()), this->url_.end(), '#');
const string ext(dot_pos.base(), hash_pos);
if (iequals(ext, "wrl")) {
media_type = openvrml::vrml_media_type;
} else if (iequals(ext, "x3dv")) {
media_type = openvrml::x3d_vrml_media_type;
} else if (iequals(ext, "png")) {
media_type = "image/png";
} else if (iequals(ext, "jpg") || iequals(ext, "jpeg")) {
media_type = "image/jpeg";
}
return media_type;
}
示例2: do_type
virtual const std::string do_type() const throw ()
{
//
// A real application should use OS facilities for this. This
// is a crude hack.
//
using std::find;
using std::string;
using boost::algorithm::iequals;
using boost::next;
string media_type = "application/octet-stream";
const string::const_reverse_iterator dot_pos =
find(this->url_.rbegin(), this->url_.rend(), '.');
if (dot_pos == this->url_.rend()
|| next(dot_pos.base()) == this->url_.end()) {
return media_type;
}
const string::const_iterator hash_pos =
find(next(dot_pos.base()), this->url_.end(), '#');
const string ext(dot_pos.base(), hash_pos);
if (iequals(ext, "wrl")) {
media_type = "model/vrml";
} else if (iequals(ext, "x3dv")) {
media_type = "model/x3d+vrml";
} else if (iequals(ext, "png")) {
media_type = "image/png";
} else if (iequals(ext, "jpg") || iequals(ext, "jpeg")) {
media_type = "image/jpeg";
}
return media_type;
}
示例3: add_rule
void add_rule(Addr first, Addr last, int flags)
{
using boost::next;
using boost::prior;
TORRENT_ASSERT(!m_access_list.empty());
TORRENT_ASSERT(first < last || first == last);
typename range_t::iterator i = m_access_list.upper_bound(first);
typename range_t::iterator j = m_access_list.upper_bound(last);
if (i != m_access_list.begin()) --i;
TORRENT_ASSERT(j != m_access_list.begin());
TORRENT_ASSERT(j != i);
int first_access = i->access;
int last_access = prior(j)->access;
if (i->start != first && first_access != flags)
{
i = m_access_list.insert(i, range(first, flags));
}
else if (i != m_access_list.begin() && prior(i)->access == flags)
{
--i;
first_access = i->access;
}
TORRENT_ASSERT(!m_access_list.empty());
TORRENT_ASSERT(i != m_access_list.end());
if (i != j) m_access_list.erase(next(i), j);
if (i->start == first)
{
// we can do this const-cast because we know that the new
// start address will keep the set correctly ordered
const_cast<Addr&>(i->start) = first;
const_cast<int&>(i->access) = flags;
}
else if (first_access != flags)
{
m_access_list.insert(i, range(first, flags));
}
if ((j != m_access_list.end()
&& minus_one(j->start) != last)
|| (j == m_access_list.end()
&& last != max_addr<Addr>()))
{
TORRENT_ASSERT(j == m_access_list.end() || last < minus_one(j->start));
if (last_access != flags)
j = m_access_list.insert(j, range(plus_one(last), last_access));
}
if (j != m_access_list.end() && j->access == flags) m_access_list.erase(j);
TORRENT_ASSERT(!m_access_list.empty());
}