I have
typedef std::string OrderID;
I would like to overload the operator ++ for this. The value of OrderID starts out at 1 and is just incremented using hex every time. Possible values are…
001
002
…
00A
00B
…
00F
010
…
1) Can you overload operators for specific type defines, so that std::string++ is not overloaded?
2) Can you increment like above (using Hex)?
Thanks
If you define
it will apply to
std::stringas well.You should use composition instead.You should use a free function that does that, not necessarily on your defined type. It could also manipulate a string, and that’s fine.