samedi 21 décembre 2019

Comment a line make the code works, while without it the code doesn't work

I was creating a complex number class under a namespace called nmb

Here is the code:

namespace nmb // nmb stands for number
{
    template<class T>
    class complex
    {
        public:
            // CONSTRUCTORS
            explicit complex() { }
            explicit complex(const T &imaginary, const T &real) : _imaginary(imaginary), _real(real) { }
            explicit complex(const complex &_complex) { *this = _complex;}

            // DESTRUCTOR
            ~complex() { } // useless, there aren't pointers, but for make it more clear

            // METHODS
            inline T real() const {return _real;}
            inline T imaginary() const {return _imaginary;}
            inline T complex_abs() const {return sqrt( pow(_imaginary,2) + pow(_real, 2)); } /* the absolute value of a complex num
                                                                                                is (a^2 + b^2)^1/2*/
            // OPERATOR OVERLADING
            inline bool operator==(const complex &Number) { return ((_imaginary==Number._imaginary) && (_real == Number._real));}
            inline bool operator!=(const complex &Number) { return !(*this == Number); }
            inline friend std::ostream & operator<<(std::ostream &os, const complex &Num)
            {
                return (os <<"(" << Num._imaginary << " , " << Num._real << ")");
            }

            inline friend std::istream & operator>>(std::istream &is, const complex &Num)
            {
                is >> Num._imaginary;
                is >> Num._real;
                return is;
            }
        private:
            T _imaginary;
            T _real;
    };


}

Main.cpp

It is not finished yet, but in order to try it out I was going to create a simple main.cpp file and I wrote this program:

int main()
{
    nmb::complex<double> a(2.4, 5.7);
    nmb::complex<double> b;

    //std::cin >> b;
    std::cout << b << "\n";
    return 0;
}

The problem is that if I leave this line //std::cin >> b; as it is, the code runs without errors.


Without the comment

However if I remove the comment

int main()
{
    nmb::complex<double> a(2.4, 5.7);
    nmb::complex<double> b;

    std::cin >> b;
    std::cout << b << "\n";
    return 0;
}

the code throws many errors.


Errors

I leave here some of the errors because all the errors make me reach the 30000 characters limit

C:\C++\C++ Programs\complex number\complex\complex.hpp||In instantiation of 'std::istream& nmb::operator>>(std::istream&, const nmb::complex<double>&)':|
C:\C++\C++ Programs\complex number\complex\main.cpp|11|required from here|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'const double')|
C:\msys64\mingw64\include\c++\9.2.0\istream|168|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|168|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'bool&' to an rvalue of type 'bool'|
C:\msys64\mingw64\include\c++\9.2.0\istream|172|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|172|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'short int&' to an rvalue of type 'short int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|175|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|175|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'short unsigned int&' to an rvalue of type 'short unsigned int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|179|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|179|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|182|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|182|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'unsigned int&' to an rvalue of type 'unsigned int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|186|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|186|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'long int&' to an rvalue of type 'long int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|190|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|190|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'long unsigned int&' to an rvalue of type 'long unsigned int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|195|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|195|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type 'long long int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|199|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|199|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to an rvalue of type 'long long unsigned int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|214|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|214|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'float&' to an rvalue of type 'float'|
C:\msys64\mingw64\include\c++\9.2.0\istream|218|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|218|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: binding reference of type 'double&' to 'const double' discards qualifiers|
C:\msys64\mingw64\include\c++\9.2.0\istream|222|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|222|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|error: cannot bind non-const lvalue reference of type 'long double&' to an rvalue of type 'long double'|
C:\msys64\mingw64\include\c++\9.2.0\istream|120|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|120|note:   no known conversion for argument 1 from 'const double' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}|
C:\msys64\mingw64\include\c++\9.2.0\istream|124|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|124|note:   no known conversion for argument 1 from 'const double' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}|
C:\msys64\mingw64\include\c++\9.2.0\istream|131|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|131|note:   no known conversion for argument 1 from 'const double' to 'std::ios_base& (*)(std::ios_base&)'|
C:\msys64\mingw64\include\c++\9.2.0\istream|235|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|235|note:   no known conversion for argument 1 from 'const double' to 'void*&'|
C:\msys64\mingw64\include\c++\9.2.0\istream|259|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|259|note:   no known conversion for argument 1 from 'const double' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}|
C:\msys64\mingw64\include\c++\9.2.0\bits\basic_string.tcc|1466|note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'|
C:\msys64\mingw64\include\c++\9.2.0\bits\basic_string.tcc|1466|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'const double'|
C:\msys64\mingw64\include\c++\9.2.0\bits\istream.tcc|931|note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)'|
C:\msys64\mingw64\include\c++\9.2.0\bits\istream.tcc|931|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|note:   deduced conflicting types for parameter '_CharT' ('char' and 'const double')|
C:\msys64\mingw64\include\c++\9.2.0\istream|756|note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)'|
C:\msys64\mingw64\include\c++\9.2.0\istream|756|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|note:   cannot convert 'Num.nmb::complex<double>::_imaginary' (type 'const double') to type 'unsigned char&'|
C:\msys64\mingw64\include\c++\9.2.0\istream|761|note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)'|
C:\msys64\mingw64\include\c++\9.2.0\istream|761|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|note:   cannot convert 'Num.nmb::complex<double>::_imaginary' (type 'const double') to type 'signed char&'|
C:\msys64\mingw64\include\c++\9.2.0\bits\istream.tcc|963|note: candidate: 'template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)'|
C:\msys64\mingw64\include\c++\9.2.0\bits\istream.tcc|963|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|note:   mismatched types '_CharT2*' and 'double'|
C:\msys64\mingw64\include\c++\9.2.0\istream|803|note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)'|
C:\msys64\mingw64\include\c++\9.2.0\istream|803|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|note:   cannot convert 'Num.nmb::complex<double>::_imaginary' (type 'const double') to type 'unsigned char*'|
C:\msys64\mingw64\include\c++\9.2.0\istream|808|note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)'|
C:\msys64\mingw64\include\c++\9.2.0\istream|808|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|note:   cannot convert 'Num.nmb::complex<double>::_imaginary' (type 'const double') to type 'signed char*'|
C:\msys64\mingw64\include\c++\9.2.0\istream|980|note: candidate: 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&)'|
C:\msys64\mingw64\include\c++\9.2.0\istream|980|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|37|required from 'std::istream& nmb::operator>>(std::istream&, const nmb::complex<double>&)'|
C:\C++\C++ Programs\complex number\complex\main.cpp|11|required from here|
C:\msys64\mingw64\include\c++\9.2.0\istream|980|error: no type named 'type' in 'struct std::enable_if<false, std::basic_istream<char>&>'|
C:\C++\C++ Programs\complex number\complex\complex.hpp||In instantiation of 'std::istream& nmb::operator>>(std::istream&, const nmb::complex<double>&)':|
C:\C++\C++ Programs\complex number\complex\main.cpp|11|required from here|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'const double')|
C:\msys64\mingw64\include\c++\9.2.0\istream|168|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|168|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'bool&' to an rvalue of type 'bool'|
C:\msys64\mingw64\include\c++\9.2.0\istream|172|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|172|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'short int&' to an rvalue of type 'short int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|175|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|175|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'short unsigned int&' to an rvalue of type 'short unsigned int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|179|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|179|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|182|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|182|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'unsigned int&' to an rvalue of type 'unsigned int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|186|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|186|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'long int&' to an rvalue of type 'long int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|190|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|190|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'long unsigned int&' to an rvalue of type 'long unsigned int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|195|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|195|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type 'long long int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|199|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|199|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to an rvalue of type 'long long unsigned int'|
C:\msys64\mingw64\include\c++\9.2.0\istream|214|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|214|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'float&' to an rvalue of type 'float'|
C:\msys64\mingw64\include\c++\9.2.0\istream|218|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|218|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: binding reference of type 'double&' to 'const double' discards qualifiers|
C:\msys64\mingw64\include\c++\9.2.0\istream|222|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' <near match>|
C:\msys64\mingw64\include\c++\9.2.0\istream|222|note:   conversion of argument 1 would be ill-formed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|error: cannot bind non-const lvalue reference of type 'long double&' to an rvalue of type 'long double'|
C:\msys64\mingw64\include\c++\9.2.0\istream|120|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|120|note:   no known conversion for argument 1 from 'const double' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}|
C:\msys64\mingw64\include\c++\9.2.0\istream|124|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|124|note:   no known conversion for argument 1 from 'const double' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}|
C:\msys64\mingw64\include\c++\9.2.0\istream|131|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|131|note:   no known conversion for argument 1 from 'const double' to 'std::ios_base& (*)(std::ios_base&)'|
C:\msys64\mingw64\include\c++\9.2.0\istream|235|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|235|note:   no known conversion for argument 1 from 'const double' to 'void*&'|
C:\msys64\mingw64\include\c++\9.2.0\istream|259|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]'|
C:\msys64\mingw64\include\c++\9.2.0\istream|259|note:   no known conversion for argument 1 from 'const double' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}|
C:\msys64\mingw64\include\c++\9.2.0\bits\basic_string.tcc|1466|note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'|
C:\msys64\mingw64\include\c++\9.2.0\bits\basic_string.tcc|1466|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'const double'|
C:\msys64\mingw64\include\c++\9.2.0\bits\istream.tcc|931|note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)'|
C:\msys64\mingw64\include\c++\9.2.0\bits\istream.tcc|931|note:   template argument deduction/substitution failed:|
C:\C++\C++ Programs\complex number\complex\complex.hpp|38|note:   deduced conflicting types for parameter '_CharT' ('char' and 'const double')|

||=== Build failed: 28 error(s), 8 warning(s) (0 minute(s), 13 second(s)) 

===|

Aucun commentaire:

Enregistrer un commentaire