help with bind

jspencer spencer8 at sbcglobal.net
Tue Jun 15 16:55:28 PDT 2010


For some reason, I can't get this simple bind example to compile w/ dmd v2.046.  Can anyone
spot what I'm missing?


---
import std.bind;
import std.stdio;

void g (int a, int b)
{
   int c = a + b;
}

void main()
{
   auto g1 = bind(&g, 3, 5);
   writeln(typeid(typeof(g1)));
}
---

gives me

---
C:\tools\dmd2\windows\bin\..\..\src\phobos\std\traits.d(117): Error: static assert
"argument has no parameters"
C:\tools\dmd2\windows\bin\..\..\src\phobos\std\traits.d(102):        instantiated from
here: ParameterTypeTuple!(EmptySlot,void)
C:\tools\dmd2\windows\bin\..\..\src\phobos\std\traits.d(113):        instantiated from
here: ParameterTypeTuple!(const(EmptySlot))
C:\tools\dmd2\windows\bin\..\..\src\phobos\std\bind.d(977):        instantiated from here:
ParameterTypeTuple!(const(EmptySlot)*)
C:\tools\dmd2\windows\bin\..\..\src\phobos\std\bind.d(1003):        instantiated from here:
FuncReferenceParamsAsPointers_impl!(NullAlias)
C:\tools\dmd2\windows\bin\..\..\src\phobos\std\bind.d(338):        instantiated from here:
FuncReferenceParamsAsPointers!(NullAlias)
C:\tools\dmd2\windows\bin\..\..\src\phobos\std\bind.d(660):        instantiated from here:
BoundFunc!(void function(int a, int b),NullAlias,Tuple!(int,int))
bTest.d(12):        instantiated from here: bind!(void function(int a, int b),int,int)

---
Thanks,
Jason


More information about the Digitalmars-d-learn mailing list