How to declare a template type as parameter to functions

Domingo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 3 15:47:31 PST 2014


One of the problems I'm facing from vibed (but I'm asking a 
general rule to help here and in other similar cases):

protected void 
sendCollectionListAsDataArrayJson2(MongoCursor!(Bson,Bson,Bson) 
collection_list, HTTPServerResponse res)
{
	if(!collection_list.empty)
	{
		auto buf = appender!string();
		buf.put("{\"data\":[\n");
		int count = 0;
		foreach(doc; collection_list)
		{
			if(count++ > 0)
			{
				buf.put(",");
			}
			
			buf.put("[");
			buf.put(doc.toJson().toString());
			buf.put("]\n");
		}
		buf.put("]}\n");
		res.writeBody(buf.data, "application/json");
	}
}

-------
../../dLib/inhouse-code/vibed_common.d(313): Error: function 
vibed_common.BaseHttpHandler.sendCollectionListAsDataArrayJson2 
(MongoCursor!(Bson, Bson, Bson) collection_list, 
HTTPServerResponse res) is not callable using argument types 
(MongoCursor!(Bson, Bson, typeof(null)), HTTPServerResponse)
../ApakauAdminCommon/vibed/geoips_mixin.d(38): Error: function 
vibed_common.BaseHttpHandler.sendCollectionListAsDataArrayJson2 
(MongoCursor!(Bson, Bson, Bson) collection_list, 
HTTPServerResponse res) is not callable using argument types 
(MongoCursor!(Bson, Bson, int[string]), HTTPServerResponse)
../ApakauAdminCommon/vibed/geoips_mixin.d(50): Error: function 
vibed_common.BaseHttpHandler.sendCollectionListAsDataArrayJson2 
(MongoCursor!(Bson, Bson, Bson) collection_list, 
HTTPServerResponse res) is not callable using argument types 
(MongoCursor!(Bson, Bson, int[string]), HTTPServerResponse)


More information about the Digitalmars-d-learn mailing list