Deprecation: std.container.array.RangeT(A) is not visible from module Size

Vino.B via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 8 08:47:39 PDT 2017


On Friday, 8 September 2017 at 14:48:38 UTC, Vino.B wrote:
> Hi All,
>
>   The below code output's the below warning, so if 
> std.container.array.RangeT(A) is deprecated then what is the 
> equivalent for this, request your help on this.
>
> Warning :
> Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
> visible from module Size
> Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
> visible from module Size
> Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
> visible from module Size
> Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
> visible from module Size
> ["C:\\Temp\\sapnas2\\BACKUP\\dir1", 
> "C:\\Temp\\sapnas2\\BACKUP\\DND3", 
> "C:\\Temp\\sapnas2\\BACKUP\\DND5"][34, 1, 5]
>
> Code:
> import std.algorithm: filter, map, fold;
> import std.container;
> import std.file: SpanMode, dirEntries, isDir, isFile;
> import std.stdio: File, writefln, writeln;
> import std.typecons: tuple, Tuple;
> import std.parallelism: parallel;
> import std.conv;
> import std.range;
>
> Tuple!(RangeT!(Array!string), RangeT!(Array!ulong)) 
> coSizeDirList () {
> 	string FFs = "C:\\Temp\\sapnas2\\BACKUP";
> 	int SizeDir = 1;
> 	ulong subdirTotal;
> 	ulong subdirTotalGB;
> 	Array!(string) Subdir;
> 	Array!(ulong) Subsize;
> 	Tuple!((Array!string), (Array!string)) Result;
> 	auto dFiles = Array!string ((dirEntries(FFs, 
> SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));
>     foreach (d; dFiles[]) {
> 				auto SdFiles = Array!ulong(dirEntries(d, 
> SpanMode.depth).map!(a => a.size));
> 				foreach(f; SdFiles[]) { subdirTotal += f; }
> 				subdirTotalGB = (subdirTotal/1024/1024); { Subdir ~= d; 
> Subsize ~= subdirTotalGB; }
> 				if (subdirTotalGB > SizeDir)
> 				subdirTotal = 0;
> 		    }
> 			return tuple (Subdir[], Subsize[]);
>
> }
>
> void main () {
> 	writeln(coSizeDirList[]);
> 	}
>
> From,
> Vino.B

Hi All,

  Was able to resolve the above issue but not sure whether it is 
correct and now i am getting the output as below, request your 
help.
Output:
C:\Temp\sapnas2\BACKUP\dir1, 34, C:\Temp\sapnas2\BACKUP\DND3, 1, 
C:\Temp\sapnas2\BACKUP\DND5, 5

Required Output:
C:\Temp\sapnas2\BACKUP\dir1                34
C:\Temp\sapnas2\BACKUP\DND3                 1
C:\Temp\sapnas2\BACKUP\DND5                 5

Program:
import std.algorithm: filter, map, fold;
import std.container;
import std.file: SpanMode, dirEntries, isDir, isFile;
import std.stdio: File, writefln, writeln;
import std.typecons: tuple, Tuple;
import std.parallelism: parallel;
import std.conv;
import std.range;

Array!string coSizeDirList () {
	string FFs = "C:\\Temp\\sapnas2\\BACKUP";
	int SizeDir = 1;
	ulong subdirTotal;
	ulong subdirTotalGB;
	Array!(string) Subsize;
	Array!string Result;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));
     foreach (d; dFiles[]) {
				auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));
				foreach(f; SdFiles[]) { subdirTotal += f; }
				subdirTotalGB = (subdirTotal/1024/1024); { Result ~= d; 
Result ~= to!string(subdirTotalGB); }
				if (subdirTotalGB > SizeDir)
				subdirTotal = 0;
		    }
			return Result;
}

void main () {
writefln("%-(%s, %)", coSizeDirList[]);
}

From,
Vino.B





More information about the Digitalmars-d-learn mailing list