views:

560

answers:

1

Duplicate

What does the unary plus operator do?

Is there any good use for the unary plus operator?

For numbers it does nothing. I suppose you could overload it for custom types, but that would be non-standard operator behaviour (bad). It also makes parsing code somewhat harder. So, are there any cases where it makes sense to overload it for a custom type? I'm designing a language, and I'm considering just leaving it out.

A: 

This is a duplicate of this question What does the unary plus operator do

Alexander Kahoun