understanding std.algorithm.mutation.fill behaivor.

LeqxLeqx via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Dec 27 21:09:34 PST 2016


Perhaps this is a stupid question, and I apologize if it is, but 
why doesn't this compile:

   import std.algorithm;
   import std.stdio;
   void main()
   {
	  char[] array = [1, 2, 3, 4];
	  char value = 2;
	  fill(array, value);
   }

if this does:

   import std.algorithm;
   import std.stdio;
   void main()
   {
	  int[] array = [1, 2, 3, 4];
	  int value = 2;
	  fill(array, value);
   }

when the only difference is the type, and the 'fill' method is 
meant to be generic?

Thanks for your time.


More information about the Digitalmars-d-learn mailing list