Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename T1, typename T2>
- struct TypeCompare { static const bool equal = false; };
- template<typename T>
- struct TypeCompare<T,T>{static const bool equal=true;};
- template<typename Q=T> //unnecessary template parameter that will trick resolution rules and let the 0 case happen
- void erase(const Q* ptr) {
- TypeCompare<T,Q> checker;
- static_assert(checker.equal,"Undefined behavior, you can only use the type of container for iterators!");
- argue(ptr >= begin() && ptr < end(), "incorrect iterator");
- erase_range<T>(&ptr, ptr + 1, end());
- size = size - 1;
- }
- doing erase<T*>.(0) would still give me ambiguous case
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement