5 #include <boost/range.hpp> 7 #include <boost/function.hpp> 23 virtual int get_i()
const = 0;
24 virtual float get_f()
const = 0;
35 virtual int get_i()
const {
return m_i; }
36 virtual float get_f()
const {
return m_f; }
44 typedef std::pair<my_iterator, my_iterator>
my_range;
102 store.push_back(
new MyClass(0,0.0));
103 store.push_back(
new MyClass(1,42.));
104 store.push_back(
new MyClass(2,6.9));
106 MyClass* first = *(store.begin());
123 cout << myobj.
get_i() <<
" " 128 vector< const IMyClass* > res(r.first, r.second);
129 AssertMsg(res.size(),
"range constructor failed.");
132 copy(r.first, r.second, back_inserter(res));
138 cerr <<
"Got: " << res.size() <<
endl;
139 AssertMsg(1 == res.size(),
"Failed to get1");
140 AssertMsg(res[0]->get_f() == 42.,
"Got wrong1");
144 AssertMsg(0 == res.size(),
"Got get10 but should not.");
148 AssertMsg(1 == res.size(),
"Failed to get just_right");
149 cerr <<
"Got: " << res[0]->get_i() <<
" " << res[0]->get_f() <<
endl;
150 AssertMsg(res[0]->get_i() == 2 && fabs(res[0]->get_f() - 6.9) < 1
e-6,
"Got just_wrong value");
IteratorAdapter< MyStoreType::iterator, my_base_iterator > my_adapted_iterator
boost::function< bool(const IMyClass *)> my_selector
bool operator()(const IMyClass *obj)
IteratorBase< const IMyClass * > my_base_iterator
virtual float get_f() const
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
virtual int get_i() const
MyClass(int i=0, float f=0.0)
bool operator()(const IMyClass *obj)
vector< MyClass * > MyStoreType
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
virtual float get_f() const =0
SelectInRange(float min, float max)
virtual int get_i() const =0
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
std::pair< my_iterator, my_iterator > my_range
my_range get_data(MyStoreType &store)
Iterator< const IMyClass * > my_iterator
QTextStream & endl(QTextStream &s)