dtl
// example showing use of std::transform() with a select_update_iterator
// functor used in the transform example
class AddOneToExampleLong : public std::unary_function<Example, Example>
{
public:
Example operator()(const Example &example)
{
Example result(example);
result.exampleLong++;
return result;
}
};
// add one to the value of the exampleLong field for all rows in the table
void TransformSelectUpdate()
{
DBView<Example> view("DB_EXAMPLE");
DBView<Example>::select_update_iterator read_update_it = view.begin();
std::transform(view.begin(), view.end(), read_update_it, AddOneToExampleLong());
}
Copyright © 2002, Michael Gradman and Corwin Joy.
Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Corwin Joy and Michael Gradman make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.