[Assorted-commits] SF.net SVN: assorted:[1193] sandbox/trunk/src/cc/boost_function.cc
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-02-18 00:30:10
|
Revision: 1193 http://assorted.svn.sourceforge.net/assorted/?rev=1193&view=rev Author: yangzhang Date: 2009-02-18 00:30:07 +0000 (Wed, 18 Feb 2009) Log Message: ----------- updated boost_function.cc with alternative syntax Modified Paths: -------------- sandbox/trunk/src/cc/boost_function.cc Modified: sandbox/trunk/src/cc/boost_function.cc =================================================================== --- sandbox/trunk/src/cc/boost_function.cc 2009-02-18 00:29:41 UTC (rev 1192) +++ sandbox/trunk/src/cc/boost_function.cc 2009-02-18 00:30:07 UTC (rev 1193) @@ -9,7 +9,20 @@ // This works... function<void()> f = bind(show, 0); bind(twice, f)(); - // ...but this does not compile. - bind(twice, bind(show, 0))(); + + // ...but this does not compile: + // + // bind(twice, bind(show, 0))(); + // + // error: conversion from ‘void’ to non-scalar type + // ‘boost::function0<void>’ requested. + + // This works... + { + function<void(int)> f = show; + function1<void, int> g = f; + function<void(int)> h = g; + h(0); + } return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |