| 1 |
#include <string> |
| 2 |
|
| 3 |
//opequal |
| 4 |
template <typename Type> |
| 5 |
bool operator==(Type const &lhs, Type const &rhs); |
| 6 |
//= |
| 7 |
|
| 8 |
template <typename Type> |
| 9 |
struct String |
| 10 |
{ |
| 11 |
struct iterator |
| 12 |
{ |
| 13 |
std::string::iterator d_iter; |
| 14 |
|
| 15 |
friend bool operator==<>(iterator const &lhs, iterator const &rhs); |
| 16 |
}; |
| 17 |
|
| 18 |
iterator begin() |
| 19 |
{ |
| 20 |
return iterator{}; |
| 21 |
} |
| 22 |
}; |
| 23 |
|
| 24 |
//code |
| 25 |
template <typename Type> |
| 26 |
inline bool operator==(String<Type>::iterator const &lhs, |
| 27 |
String<Type>::iterator const &rhs) |
| 28 |
{ |
| 29 |
return lhs.d_iter == rhs.d_iter; |
| 30 |
} |
| 31 |
//= |
| 32 |
|
| 33 |
int main() |
| 34 |
{ |
| 35 |
String<int> str; |
| 36 |
return str.begin() == str.begin(); |
| 37 |
} |