Where / how are arithmetic operators for atomic <T> defined?

Standard arithmetic operators, such as *and +, work as expected on classes such as atomic< int >. However, I cannot find their definitions in the header file <atomic>and do not refer to them in the standard.

Are they implicitly defined somewhere, or am I just looking in the wrong place?

For example, where is the multiplication function specified in the following code defined?

#include <iostream>
#include <atomic>
using namespace std;

int main() {

    atomic< int > i( 42 );
    atomic< float > f( 6.66 );

    cout << i * f;
    //cout << operator*( i, f); //error: ‘operator*’ not defined

    return 0;
}

For everyone who reads this question, there is a pleasant discussion of what is going on here .

+3
source share
2 answers

atomic operator T, - i * f , , CPU, int float int float, operator<< float .

, , , , . , .

+2

atomic<T> operator T(). .

+1

All Articles