boost-range Questions

5

Solved

I tried to compile this code: #include <boost/range/adaptors.hpp> #include <boost/range/algorithm.hpp> #include <vector> int main() { std::vector<int> v{ 1,5,4,2,8,5,3,7...
Argentite asked 8/8, 2012 at 20:22

3

Solved

The C++11 range-based for loop dereferences the iterator. Does that mean that it makes no sense to use it with boost::adaptors::indexed? Example: boost::counting_range numbers(10,20); for(auto i :...
Mochun asked 17/5, 2013 at 18:53

2

Solved

The implementation of boost::lower_bound (found here) in Range 2.0 takes its argument by value. Why is this? std::lower_bound takes its argument by const ref - see here
Whitman asked 2/4, 2019 at 13:42

2

Solved

I have functions that take in std::vector iterators, as in typedef std::vector<Point> Points; Points ConvexHull(Points::const_iterator first, Points::const_iterator last); I usually pass ...
Trisect asked 19/3, 2019 at 11:27

2

Solved

Is it possible/achievable to negate a boost filtered adaptor, e.g. std::vector<int> v = {1, 2, 3, 4, 5}; for(auto i : v | !filtered(is_even)) std::cout << i << std::endl; // pri...
Loreeloreen asked 8/2, 2013 at 9:28

2

Solved

I have a C array of ints, and its size, i.e. int* arr, unsigned size. I want to have something like a view from it, which will have pairs of ints as elements. To clarify, the task is: I receive an ...
Campney asked 21/12, 2018 at 9:52

1

Solved

I am working on a project which uses a couple of boost libraries. When looking at our test reports, we have seen that test coverage information sometimes does fit to our source code. I was able to ...
Moshemoshell asked 19/10, 2015 at 15:2

3

Solved

I'm trying to use boost::adaptors::transformed by providing a c++0x lambda to the adaptor. The following code does not compile. I'm using g++ 4.6.2 with boost 1.48. #include <iostream> #in...
Appetence asked 1/10, 2012 at 11:27

3

Solved

Considering: #include <cassert> #include <boost/range/irange.hpp> #include <boost/range/algorithm.hpp> int main() { auto range = boost::irange(1, 4); assert(boost::find(range,...

1

Solved

I have been seeing crashes in our software since I updated to boost 1.58 and VS2013. Only when compiler optimization is on we see that crashes. With boost 1.55 there are no crashes. I've managed to...
Officinal asked 14/7, 2015 at 9:30

1

Solved

Streams library has a neat map function to view a range by a member function. Is there any equivalent view in Range-V3? Would view::transform be the only option?
Poisonous asked 17/3, 2015 at 22:25

1

Solved

The C++11 algorithms std::is_sorted and std::is_sorted_until both require ForwardIterators. However, the Boost.Range version boost::is_sorted only requires SinglePassRanges which corresponds to Inp...
Bluh asked 26/2, 2014 at 10:10

1

Python's itertools has tee for n-plicating iterables: def tee(iterable, n=2): it = iter(iterable) deques = [collections.deque() for i in range(n)] def gen(mydeque): while True: if not mydeque...
Malicious asked 1/11, 2012 at 16:52

2

Solved

What are the benefits of using boost::any_range? Here is an example: typedef boost::any_range< int , boost::forward_traversal_tag , int , std::ptrdiff_t > integer_range; void display_in...
Massengale asked 15/3, 2013 at 21:22

1

Solved

I'm trying to chain a boost::adaptors::transformed (let's call it map) to a boost::adaptors::filtered (let's call it filter) - the idea is to map a fun that returns a "Maybe" (in my case, a std::pa...
Heydon asked 9/11, 2012 at 2:2

2

Solved

I have been going through the boost::range library and noticed boost::range_iterator and boost::iterator_range. I am confused with these terms here. Could anyone please explain what is the differen...
Mcelrath asked 8/11, 2012 at 10:11

2

Solved

I started playing with Boost::Range in order to have a pipeline of lazy transforms in C++. My problem now is how to split a pipeline in smaller parts. Suppose I have: int main(){ auto map = boost...
Tallyman asked 5/11, 2012 at 22:57

1

Solved

I have a std::multimap, and I want to create a boost::iterator_range from equal_range. I found no simple way of doing it in the documentation, so I tried the following: typedef std::multimap<in...
Disjoint asked 16/4, 2012 at 9:41

1

Solved

I'd like to use boost::range to pull off something similar to the "fancy indexing" available in NumPy and Matlab. Specifically, I would like to select certain elements of one indexable container us...
Arbe asked 25/8, 2011 at 20:42
1

© 2022 - 2024 — McMap. All rights reserved.