On Monday, 4 August 2014 at 22:45:15 UTC, anonymous wrote:
On Monday, 4 August 2014 at 22:18:24 UTC, splatterdash wrote:
Indeed I do. I'm not sure which type I should use for the
common base type, though. MyFileReader is a templated class,
so using it plainly did not work. I also tried
Hello everyone,
I'm trying to write a command-line application that can detect
whether the input file is gzipped or not. Sounds simple enough,
but I can't seem to do it properly in D (this is my first foray
to the language).
After checking whether the file is gzipped or not, I try to
On Monday, 4 August 2014 at 22:00:18 UTC, splatterdash wrote:
```
File f = File(input_file)
// detect gzip ...
if (isGzip)
{
auto fileIter = new MyFileReader!GzipIterator(f)
}
else
{
auto fileIter = new MyFileReader!NormalIterator(f)
}
foreach(string line; fileIter) {
// do
On Monday, 4 August 2014 at 22:09:49 UTC, anonymous wrote:
On Monday, 4 August 2014 at 22:00:18 UTC, splatterdash wrote:
```
File f = File(input_file)
// detect gzip ...
if (isGzip)
{
auto fileIter = new MyFileReader!GzipIterator(f)
}
else
{
auto fileIter = new
On Monday, 4 August 2014 at 22:18:24 UTC, splatterdash wrote:
Indeed I do. I'm not sure which type I should use for the
common base type, though. MyFileReader is a templated class, so
using it plainly did not work. I also tried `InputRange!string`
to no avail despite `MyFileReader`