Ticket #5993: range_accumulate_bug.cpp

File range_accumulate_bug.cpp, 591 bytes (added by Julien Nitard <julien.nitard@…>, 11 years ago)

sample to reproduce the problem

Line 
1#include <boost/noncopyable.hpp>
2#include <boost/range/numeric.hpp>
3
4#include <vector>
5
6template <class T>
7class NCVec : boost::noncopyable
8{
9 std::vector<T> _actual;
10
11public:
12 typedef typename std::vector<T>::const_iterator const_iterator;
13
14 const_iterator begin() const
15 {
16 return _actual.begin();
17 }
18
19 const_iterator end() const
20 {
21 return _actual.end();
22 }
23
24 void emplace_back(T&& t)
25 {
26 _actual.emplace_back(std::forward<T>(t));
27 }
28};
29
30
31void f()
32{
33 NCVec<int> a;
34
35 boost::accumulate(a, 0);
36}