How to use std.bind?

Sean Eskapp eatingstaples at gmail.com
Mon Jan 17 09:03:15 PST 2011


I used to use boost::bind all the time, but std.bind has me stumped, as I keep
getting static asserts with a cryptic "argument has no parameters" message. At
this point, the code is just:

class Foo
{
	void bar(int i) { writeln(i); }
}

void main()
{
	auto foobar = new Foo;
	bind(&foobar.bar, 5)();
}

I've tried a myriad of different ways, but keep coming up with the same error.
Using bindAlias gives me an error that "std.bind.bindAlias(alias FT) is not a
function template.

I'm using DMD v2.051 on a Windows platform. Help anybody?


More information about the Digitalmars-d-learn mailing list