예제 #1
0
Matrix& Matrix::operator=(const std::string& s) {
	std::string s1 = str_trim(str_replace(str_replace(s, "]", " "), "[", " "));
	size_t rows = std::count(s1.begin(), s1.end(), ';');
	std::string first = str_trim(str_before(s1, ";"));
	size_t cols = std::count(first.begin(), first.end(), ' ');
	init(rows+1, cols+1);
	std::string ss = str_trim(str_replace(s1, ";", " "));
	std::istringstream iss(ss);
	for(size_t i=0; i<height; i++) {
		for(size_t j=0; j<width; j++) {
			iss >> data[i*width + j];
		}
	}
	return *this;
}
예제 #2
0
파일: util.cpp 프로젝트: Windfisch/fm-synth
string extract_var(string s)
{
	return str_before(s,'=',"");
}