
Dave Abrahams wrote
on Wed Jun 27 2012, Lorenzo Caminiti <lorcaminiti-AT-gmail.com> wrote:
Hello all,
I'm thinking to expand Boost.Contract to support C++11-like auto-functions for C++03.
I got a ticket for it: https://sourceforge.net/apps/trac/contractpp/ticket/59 But I might implement it only after the Boost review... (Are C++11 auto-function really useful?)
auto functions arelly are useful, but mostly they're useful with a macro that calculates noexcept, return type, etc.: http://lists.boost.org/Archives/boost/2012/04/191926.php
I see but that only applies to C++11 and not to auto-functions emulated in C++03 (because there's no noexcept in C++03). Also, these type of macros only apply to 1-liner functions (of course, as you show using operator, you can concatenate a bunch of expressions on a single line). Contract++ could support something like that: // auto swap(B& x, B& y) RETURNS(swap(x.a,y.a), swap(x.b,y.b), ...); struct B { A a, b; } // Defines swap to return `return ...` and automatically figures out noexcept (on C++11). CONTRACT_FUNCTION_DEF( auto (swap) ( (B&) x, (B&) y ) return(swap(x.a, y.a), swap(x.b, y.b)) ) I'll think more about this when/if I implement auto-functions support for Contract++. --Lorenzo -- View this message in context: http://boost.2283326.n4.nabble.com/contract-C-11-like-auto-functions-tp46321... Sent from the Boost - Dev mailing list archive at Nabble.com.