diff options
| -rw-r--r-- | libadhocutil/compileTimeFormatter.h | 3 | ||||
| -rw-r--r-- | libadhocutil/unittests/testCompileTimeFormatter.cpp | 6 | 
2 files changed, 8 insertions, 1 deletions
| diff --git a/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h index 562c511..9dae0ef 100644 --- a/libadhocutil/compileTimeFormatter.h +++ b/libadhocutil/compileTimeFormatter.h @@ -166,7 +166,8 @@ namespace AdHoc {  			 * @return the stream.  			 */  			template<typename stream, typename ... Pn> -			inline stream & operator()(stream & s, const Pn & ... pn) const +			inline typename std::enable_if<(bool)&stream::write, stream>::type & +			operator()(stream & s, const Pn & ... pn) const  			{  				return write(s, pn...);  			} diff --git a/libadhocutil/unittests/testCompileTimeFormatter.cpp b/libadhocutil/unittests/testCompileTimeFormatter.cpp index b02eadd..7313252 100644 --- a/libadhocutil/unittests/testCompileTimeFormatter.cpp +++ b/libadhocutil/unittests/testCompileTimeFormatter.cpp @@ -465,6 +465,12 @@ BOOST_AUTO_TEST_CASE(user_defined_literal_fmt_get)  	BOOST_CHECK_EQUAL("foo 42", "foo %?"_fmt(42));  } +BOOST_AUTO_TEST_CASE(user_defined_literal_fmt_get_reference) +{ +	int x = 42; +	BOOST_CHECK_EQUAL("foo 42", "foo %?"_fmt(x)); +} +  BOOST_AUTO_TEST_CASE(user_defined_literal_fmt_write)  {  	std::stringstream str; | 
