Skip to content

Instantly share code, notes, and snippets.

@csujedihy
Created February 15, 2016 19:37
Show Gist options
  • Save csujedihy/3ccc3a04a5c71235b0d1 to your computer and use it in GitHub Desktop.
Save csujedihy/3ccc3a04a5c71235b0d1 to your computer and use it in GitHub Desktop.
main.cpp:119:16: error: no viable overloaded '='
v2[14] = 'S';
~~~~~~ ^ ~~~
./My_vec.h:24:13: note: candidate function not viable: no known conversion from
'char' to 'const My_vec<char>' for 1st argument
My_vec<T>& operator=(const My_vec<T>& vec);
^
main.cpp:248:16: error: no viable overloaded '='
v2[14] = 'S';
~~~~~~ ^ ~~~
./My_vec.h:24:13: note: candidate function not viable: no known conversion from
'char' to 'const My_vec<int>' for 1st argument
My_vec<T>& operator=(const My_vec<T>& vec);
^
main.cpp:367:16: error: no viable overloaded '='
v2[14] = 'S';
~~~~~~ ^ ~~~
./My_vec.h:24:13: note: candidate function not viable: no known conversion from
'char' to 'const My_vec<double>' for 1st argument
My_vec<T>& operator=(const My_vec<T>& vec);
^
./My_vec.h:192:30: error: reference to type 'const char' could not bind to an
rvalue of type 'nullptr_t'
vec.replace_at_rank(max, nullptr)...
^~~~~~~
main.cpp:115:9: note: in instantiation of function template specialization
'sort_max<char>' requested here
sort_max(v2);
^
./My_vec.h:32:39: note: passing argument to parameter 'elem' here
void replace_at_rank(int r, const T& elem);
^
./My_vec.h:79:9: error: non-const lvalue reference to type 'My_vec<char>' cannot
bind to a value of unrelated type 'char'
return ptr[i];
^~~~~~
main.cpp:119:11: note: in instantiation of member function
'My_vec<char>::operator[]' requested here
v2[14] = 'S';
^
In file included from main.cpp:7:
./My_vec.h:192:30: error: reference to type 'const int' could not bind to an
rvalue of type 'nullptr_t'
vec.replace_at_rank(max, nullptr)...
^~~~~~~
main.cpp:244:9: note: in instantiation of function template specialization
'sort_max<int>' requested here
sort_max(v2);
^
./My_vec.h:32:39: note: passing argument to parameter 'elem' here
void replace_at_rank(int r, const T& elem);
^
./My_vec.h:79:9: error: non-const lvalue reference to type 'My_vec<int>' cannot
bind to a value of unrelated type 'int'
return ptr[i];
^~~~~~
main.cpp:248:11: note: in instantiation of member function
'My_vec<int>::operator[]' requested here
v2[14] = 'S';
^
In file included from main.cpp:7:
./My_vec.h:192:30: error: reference to type 'const double' could not bind to an
rvalue of type 'nullptr_t'
vec.replace_at_rank(max, nullptr)...
^~~~~~~
main.cpp:363:9: note: in instantiation of function template specialization
'sort_max<double>' requested here
sort_max(v2);
^
./My_vec.h:32:39: note: passing argument to parameter 'elem' here
void replace_at_rank(int r, const T& elem);
^
./My_vec.h:79:9: error: non-const lvalue reference to type 'My_vec<double>'
cannot bind to a value of unrelated type 'double'
return ptr[i];
^~~~~~
main.cpp:367:11: note: in instantiation of member function
'My_vec<double>::operator[]' requested here
v2[14] = 'S';
^
9 errors generated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment