implements unique algorithm

An iterator into a dead range can still be a valid iterator in some cases, e.g., when the dead range is a simple view of a container that outlives the range.

I really don't know how to solve this problem cleanly but I strongly believe that this problem needs to be solved. This works

```c++
auto rng = as_range(container);
unique(rng);
```

but this should work too:

```c++
unique(as_range(container));
```

and the iterator (or range) returned by `unique` should also be usable in this case.

I'd rather allow some erroneous programs by invoking undefined behavior than forbid a construct that I consider very useful (maybe due to my experience with Boost.Range, but I'm just used to this idiom).