import core.atomic; void main() { int num1 = 1; int num2 = 1; int res = atomicOp!"^^"(num1, num2); } Errors: d:\dmd2\windows\bin\..\..\src\druntime\import\core\atomic.di(96): Error: must import std.math to use ^^ operator d:\dmd2\windows\bin\..\..\src\druntime\import\core\atomic.di(6): Error: template instance core.atomic.atomicOp!("^^",int,int) error instantiating
That's correct. You need to import std.math if you want to use ^^.
(In reply to comment #1) > That's correct. You need to import std.math if you want to use ^^. Oh sorry. Misunderstood. Yes, ^^ should not be used anywhere in core.*
Then if ^^ isn't going to be usable w/o importing std.math anytime soon, I guess we need to get rid of it from core.atomic.
...or, since the whole thing is based on doing the operation and CASing back the result, we could make a version of atomicOp that takes an arbitrary lambda expression.
(In reply to comment #3) > Then if ^^ isn't going to be usable w/o importing std.math anytime soon, I > guess we need to get rid of it from core.atomic. Yes. Something so high level has no business being in core. pow() for floating point exponents is a *huge* function.