flyrev@flyrev-VirtualBox:~/Desktop$ cat test.cpp #include template class wrapped_vector { private: std::vector elements; public: wrapped_vector() { elements.resize(20); } typename std::vector::reference operator[](typename std::vector::size_type i) { return elements[i]; } typename std::vector::const_reference operator[](int i) const { return elements[i]; } }; int main(void) { wrapped_vector test_int; test_int[0] = 1; wrapped_vector test_bool; test_bool[0] = true; } flyrev@flyrev-VirtualBox:~/Desktop$ g++ test.cpp test.cpp: In function ‘int main()’: test.cpp:23:12: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default] test.cpp:16:43: note: candidate 1: typename std::vector::const_reference wrapped_vector::operator[](int) const [with T = int; typename std::vector::const_reference = const int&] test.cpp:12:37: note: candidate 2: typename std::vector::reference wrapped_vector::operator[](typename std::vector::size_type) [with T = int; typename std::vector::reference = int&; typename std::vector::size_type = long unsigned int] test.cpp:23:16: error: assignment of read-only location ‘test_int.wrapped_vector::operator[](0)’ test.cpp:26:13: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default] test.cpp:16:43: note: candidate 1: typename std::vector::const_reference wrapped_vector::operator[](int) const [with T = bool; typename std::vector::const_reference = bool] test.cpp:12:37: note: candidate 2: typename std::vector::reference wrapped_vector::operator[](typename std::vector::size_type) [with T = bool; typename std::vector::reference = std::_Bit_reference; typename std::vector::size_type = long unsigned int] test.cpp:26:17: error: lvalue required as left operand of assignment flyrev@flyrev-VirtualBox:~/Desktop$