本文整理汇总了C++中boost::iterator_range类的典型用法代码示例。如果您正苦于以下问题:C++ iterator_range类的具体用法?C++ iterator_range怎么用?C++ iterator_range使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了iterator_range类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ancestor_iterator
ancestor_iterator(boost::iterator_range<ParentIterator> r)
:parent_it(r.begin()), parent_end(r.end()), depth(0) {
if (parent_it != parent_end) {
c.reset(new typename super::value_type(*parent_it));
find_next_parent();
}
};
示例2: found_object
void found_object(boost::iterator_range<Iterator> m) {
std::string s(m.begin(), m.end());
cout << "Found object name :" << s <<endl;
method.is_object=true;
iface_objects.push_back( s );
method.name = s;
cout << method << endl;
}
示例3: variable
explicit variable(boost::iterator_range<Iterator> const& token) :
_position(token.begin().position())
{
// Remove the $ from the name
auto it = token.begin();
++it;
_name.assign(it, token.end());
validate_name();
}
示例4: string_generate
inline bool string_generate(OutputIterator& sink
, boost::iterator_range<Iterator> const& r, CharEncoding, Tag)
{
Iterator end = r.end();
for (Iterator it = r.begin(); it != end; ++it)
{
*sink = spirit::char_class::convert<CharEncoding>::to(Tag(), *it);
++sink;
}
return detail::sink_is_good(sink);
}
示例5: attribute_iterator
attribute_iterator(boost::iterator_range<ParentIterator> r)
:parent_it(r.begin()), parent_end(r.end()) {
if (parent_it != parent_end) {
auto attributes = (*parent_it).attributes();
attribute_it = attributes.begin();
attribute_end = attributes.end();
if (attribute_it == attribute_end) {
go_to_next();
}
}
}
示例6: descendant_iterator
descendant_iterator(boost::iterator_range<ParentIterator> r)
:parent_it(r.begin()), parent_end(r.end()), depth(0) {
if (parent_it != parent_end) {
c.reset(new typename super::value_type(*parent_it));
if (c->has_children()) {
c->first_child();
depth++;
} else {
find_next_leaf();
}
}
};
示例7: regex
explicit regex(boost::iterator_range<Iterator> const& token) :
_position(token.begin().position())
{
auto start = token.begin();
auto end = token.end();
if (start != end) {
++start;
}
// Move the end to the position before the closing / character
auto last = start;
for (auto current = start; current != end; ++current) {
last = current;
}
_value.assign(start, last);
}
示例8: apply
static boost::tuple< boost::iterator_range<InputIterator>, size_t >
apply(unsigned long& v, boost::iterator_range<InputIterator> const& input){
auto iter = input.begin();
auto const& end = input.end();
unsigned char * raw_int = reinterpret_cast<unsigned char*>(&v);
unsigned char const * const raw_int_end = raw_int+sizeof(v);
while(raw_int!=raw_int_end){
if( iter==end ) STCRYPT_THROW_EXCEPTION( sio::exception::underflow() );
*raw_int = *iter;
++iter;
++raw_int;
}
return boost::make_tuple( boost::make_iterator_range(iter, end), sizeof(unsigned long) );
}
示例9: response_callback_with_reply
// callback to receive reply from server
// reply - pointer to reply string
// cv - pointer to condition variable to notify sender with
void response_callback_with_reply(boost::iterator_range<char const *> const &a,
boost::system::error_code const &error_code,
std::string *reply,
std::condition_variable *cv)
{
if (!error_code) {
//std::unique_lock<std::mutex> scoped_lock(reply_mutex);
reply->append(a.begin());
} else {
if (error_code == boost::asio::error::eof) {
// notify request sender with condition variable about transfer finish
cv->notify_all();
}
}
}
示例10: unpackAndUncompressInteger
void unpackAndUncompressInteger(
const boost::iterator_range<detail::ByteSequence::const_iterator>&
range,
Integer& value) {
unsigned char* valuePointer = reinterpret_cast<unsigned char*>(&value);
detail::ByteSequence::const_iterator iterator = range.begin();
const unsigned char& size = *iterator;
++iterator;
constexpr unsigned char maxSize = static_cast<unsigned char>(sizeof(value));
unsigned char leadingZeroBytes = maxSize - size;
PackedValue packedValue;
unsigned char* valueArray =
reinterpret_cast<unsigned char*>(&packedValue) + leadingZeroBytes;
std::copy(iterator, iterator + size, valueArray);
//value = static_cast<Integer>(packedValue - getOffset<Integer>());
}
示例11: unpackAndUnshiftInteger
std::size_t unpackAndUnshiftInteger(
const boost::iterator_range<detail::ByteSequence::const_iterator>&
range,
Integer& value) {
PackedValue packedValue = boost::endian::big_to_native(
*reinterpret_cast<const PackedValue*>(&*range.begin()));
if (packedValue >= getOffsetZero<PackedValue>()) {
value = static_cast<Integer>(
packedValue - getOffset<Integer, PackedValue>());
} else {
value = static_cast<Integer>(packedValue) -
getOffset<Integer, PackedValue>();
}
return sizeof(value);
}
示例12: found_arg_desc
void found_arg_desc(boost::iterator_range<Iterator> m) {
std::string s(m.begin(), m.end());
// cout << "Found arg desc :" << s <<endl;
bf::get<1>(method.args.back()) = s;
}
示例13: found_arg
void found_arg(boost::iterator_range<Iterator> m) {
std::string s(m.begin(), m.end());
// cout << "Found arg :" << s <<endl;
method.args.push_back( arg_desc_type(s,"") );
}
示例14: found_desc
void found_desc(boost::iterator_range<Iterator> m) {
std::string s(m.begin(), m.end());
// cout << "Found description :" << s <<endl;
method.description = s;
}
示例15: Parser
Parser::Parser(boost::iterator_range<ByteBuffer::const_iterator> range) :
Parser(range.begin(), range.end())
{
}