Nop not working because write is a class member... You need to work
around it if you want to use for_each... So you loose the 'elegance' of
for_each...

On 23/02/2013 14:36, serge-sans-paille wrote:
> In pythran/pythonic++/core/file.h:
> 
>> +						throw IOError("file.write() :  File not opened for writing.");
>> +					if (size <0) size = this->tell();
>> +					ftruncate(fileno(), size);
>> +				}
>> +
>> +				void write(core::string const& str){
>> +					if(not is_open) throw ValueError("I/O operation on closed file");
>> +					if (mode.find_first_of("wa+") == std::string::npos) 
>> +						throw IOError("file.write() :  File not opened for writing.");
>> +					fwrite(str.c_str(), sizeof(char), str.length(), **data);
>> +				}
>> +
>> +				template<class T>
>> +					void writelines(T const& seq){
>> +						auto end = seq.end();
>> +						for(auto it = seq.begin(); it != end; ++it){
> 
> voire même std::foreach(seq.begin(), seq.end(), write)
> 
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/serge-sans-paille/pythran/pull/49/files#r3126668>.
>