Учитывая определение ci_string из cpp.reference.com, как бы мы пошли о реализации оператор >>? В моих попытках использовался std :: read, но, похоже, он не работает (то есть gcount () правильно подсчитывает количество введенных символов, но ничего не выводит)
#include <iostream>
#include <cctype>
#include <string>
// ci_string definition goes here
std::istream& operator>>(std::istream& in, ci_string& str)
{
return in.read(&*str.begin(), 4);
}
int main()
{
ci_string test_str;
std::cin >> test_str;
std::cout << test_str;
return 0;
}
Как насчет
std::istream& operator>>(std::istream& in, ci_string& str)
{
std::string tmp;
in >> tmp;
str.assign( tmp.begin(), tmp.end() );
return in;
}
Других решений пока нет …