
On 23.04.2013, at 08:48, Andrew Ho
However, the main concern is that in practical code it may be difficult to identify and isolate issues which could crop up. The question is do we try to provide safer code, more efficient code, or both?
If possible: Obviously both. I think that efficiency should be the primary goal, otherwise people will end up not using Boost.Operators in performance-critical applications and they will write their own code which might have even more bugs/problems. Safety is therefore also important, but in case of doubt I think we should use the more efficient code and document the pitfalls. I guess C++ already has a history of that approach :) If the only problem is binding a reference to the result it's also explicitly visible in the user's code, it's not something that introduces a bug silently.
What compiler-specific code should the re-write reasonably have to take into account? Only standard-compliant features, or are there some notable exceptions of known issues? I'm assuming we're going to at a minimum support C++03 and C++11 versions. Also, should we worry about maintaining the NRVO code?
The major guidelines from my point of view are: - If no one can and will test an existing work-around, there is no point in keeping it. - If someone is able and willing to test, the work-arounds should not have any negative impact for conforming/good compilers. - C++11 should be optional, using Boost.Config to detect support for rvalue references, noexcept, … - NRVO: Do you mean the work-around in case the compiler is *not* able to apply the NRVO? Good question.
The last thing I can think of is what about the left operators? Should they be provided in a similar fashion like commutative/non commutative?
I don't quite understand what you have in mind, could you elaborate, please? For df.operators, you already have the choice of using commutative_foo