You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dear,
When you need to manage various file format and trying to fit as a phobos File it appear below feature could be really interesting.
by example you have a parser you want to construct is from various file type you can grant some methods.
-----------------------------------------------------------
template isFileType(F)
{
enum bool isFileType = is(typeof(
{
ubyte[] buf;
F f = void; // can define a FileType object
if (f.eof) {} // can test for end of file
if (f.isOpen) {} // can test for opened file
f.name; // can invoke name
f.close(); // can invoke close
r.write(); // can invoke write()
r.rawWrite( "" ); // can invoke rawWrite()
r.rawRead( buf ); // can invoke rawRead()
}));
}
struct FileType( F ) if( isFileType( F ) )
{
F _f;
this( F file ){
_f = file;
}
alias _f this;
}
The text was updated successfully, but these errors were encountered:
bioinfornatics (@bioinfornatics) reported this on 2013-03-14T03:45:19Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=9716
CC List
Description
The text was updated successfully, but these errors were encountered: