Assert that code does NOT compile

template<class T>struct sink{typedef void type;}; template<class T>using sink_t=typename sink<T>::type; template<typename T, typename=void>struct my_test:std::false_type{}; template<typename T>struct my_test<T, sink_t<decltype( put code here. Note that it must “fail early”, ie in the signature of a function, not in the body )> >:std::true_type {}; The above generates a test if the “put code here” can be evaluated. To determine … Read more

error : BOOST DISABLE THREADS

The experimental GCC version 4.7 disables Boost.Threads. See: https://svn.boost.org/trac/boost/ticket/6165 Edit: It should be noted that as of the release version of GCC 4.7, and Boost higher than 1.48 (Boost_1_48_0 is still not working), threads works again.

C++ range/xrange equivalent in STL or boost?

Boost irange should really be the answer (ThxPaul Brannan) I’m adding my answer to provide a compelling example of very valid use-cases that are not served well by manual looping: #include <boost/range/adaptors.hpp> #include <boost/range/algorithm.hpp> #include <boost/range/irange.hpp> using namespace boost::adaptors; static int mod7(int v) { return v % 7; } int main() { std::vector<int> v; boost::copy( … Read more