Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
4003CEM-iterators/lab_stl.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19 lines (15 sloc)
602 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
/* Complete the function so that it calculates the sum of the | |
unique values in the given sequence. | |
i.e. if the sequence was 1, 2, 3, 2, 4, 2 | |
then the unique values would be 1, 2, 3, 4 | |
the sum of these unique values would be 10 | |
Make use of the EXISTING features of the STL, it is possible | |
to solve this entirely using existing functions. | |
The algorithms library in particular may be helpful | |
https://en.cppreference.com/w/cpp/algorithm | |
*/ | |
int sum_uniques( std::vector<int>::iterator begin, | |
std::vector<int>::iterator end ) | |
{ | |
} |