-
Notifications
You must be signed in to change notification settings - Fork 0
/
TODO.txt
36 lines (31 loc) · 1.92 KB
/
TODO.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Function overloading (can and can-not do's ) play with different parameter type, but same number of args (so foo(<T>), foo (<W>)
Look at all the TODOs below:
#include <algorithm>
#include <iterator>
#include <string>
#include <iostream> //for on-screen debugging/testing
//size_t duplicateCount(const std::string& in); // helper for tests
//size_t duplicateCount(const char* in) //TODO come back to this (C-String? Is that what this is?)
size_t duplicateCount(const std::string& in)
{
size_t count = 0;
//TODO: look into this error: lvalue casts are not supported (the issue is the static_cast)
auto it = std::find_if(begin(in), end(in), [](auto elem){return elem != ' ';}); //TODO :
//cant do elem == " " as this is a char* look into this
//TODO: how does the empty case work? ("") ??
while (it != end(in))
{
auto newIt = it;
while (newIt != end(in))
{
count = std::count_if((it+1), end(in),[it](auto elem){return elem == *it;});
++newIt;
}
++it;
}
if (count > 0)
return count;
return 0;
//auto newIt = begin(in)-(it-2);
//TODO: At least in THIS context can't add iterators, but can subtract...
}