Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void DoSomething(const std::vector<SomeType>& in, std::vector<SomeType>& out)
- {
- ...
- // no need to return anything, just modify out
- }
- void DoSomething(iterator const & from, iterator const & to);
- std::vector theOutput(inputVector);
- template <typename InIt, typename OutIt>
- void DoMagic(InIt first, InIt last, OutIt out)
- {
- for(; first != last; ++first) {
- if(IsCorrectIngredient(*first)) {
- *out = DoMoreMagic(*first);
- ++out;
- }
- }
- }
- std::vector<MagicIngredients> ingredients;
- std::vector<MagicResults> result;
- DoMagic(ingredients.begin(), ingredients.end(), std::back_inserter(results));
- tuple<int, int, double> add_multiply_divide(int a, int b) {
- return make_tuple(a+b, a*b, double(a)/double(b));
- }
- list<int> foo(void)
- {
- list<int> l;
- // do something
- return l;
- }
- list<int> lst=foo();
- list<int> lst;
- // do anything you want with list
- lst.swap(foo());
Add Comment
Please, Sign In to add comment