takeWhile, groupBy and group higher order functions
struct equal is kind of useless. There's std::equal_to, which does the same thing.
You can make the design more flexible (and more standard library-like) by passing an output iterator to the groupBy and group function instead of creating a new container inside the function. It's useful if the user wants to write pairs that represent groups to an existing container or to a C-style array.