Type conversion from std::complex<MyType> to std::complex<double>
问题 I have a class MyType that implements a user-defined arithmetic type. This class provides the following conversion operator struct MyType { ... operator double() { return to_double(); // This converts my type to a double value } ... }; Using this class as follows works fine: double d = MyType(1); However, using this class as type within std::complex, e.g. #include <complex> std::complex<double> c = std::complex<MyType>(1,1); fails with the following compiler error: error: conversion from 'std