Remarks on std.container

Matthias Walter xammy at xammy.homelinux.net
Thu Mar 8 02:16:15 PST 2012


On 03/08/2012 10:48 AM, James Miller wrote:
> On Thursday, March 08, 2012 10:21:48 Matthias Walter wrote:
>> but the following did not work:
>>
>> std.algorithm.swap(arrayInstance[i], arrayInstance[j]);
> 
> What error did you get exactly? Since that exact call should work. "It
> didn't work" doesn't help.

Of course - sorry for the imprecise description:


import std.container;
import std.algorithm;

int main(char[][] args)
{
  auto c = Array!(double)(cast(double[]) []);
  c.insertBack(1.0);
  c.insertBack(2.0);
  std.algorithm.swap(c[0], c[1]);

  return 0;
}

yields:

main.d(9): Error: template std.algorithm.swap(T) if (isMutable!(T) &&
!is(typeof(T.init.proxySwap(T.init)))) does not match any function
template declaration
main.d(9): Error: template std.algorithm.swap(T) if (isMutable!(T) &&
!is(typeof(T.init.proxySwap(T.init)))) cannot deduce template function
from argument types !()(double,double)


Best regards,

Matthias


More information about the Digitalmars-d-learn mailing list