problem about member-function-Collection of common programming errors
iavr
c++ templates c++11 member-function ref-qualifier
This compiles fine in clang 3.3:template <typename T> struct M;template <typename R, typename C, typename… A> struct M <R (C::*)(A…)> { };template <typename R, typename C, typename… A> struct M <R (C::*)(A…) &> { };but fails in gcc 4.8.1:[…] error: redefinition of ‘struct M <R (C::*)(A …)>’struct M <R (C::*)(A…) &> { };^ […] error: previous definition of ‘struct M <R (C::*)(A …)>’struct M <R (C::*)(A…)> { };^When u
pmr
c++ design boolean default-arguments member-function
We have several classes where a call to a member function may change state and sometimes not depending on a boolean with default value.A a;a.set( “foobar” );assert( a.changed() == true );versusA a;a.set( “foobar”, false );assert( a.changed() == false );Please note that those member functions are virtual. I would favor to use an alias to better read code and make a private member function still allowing the old method and give only the wrappers to the public:a.silentlySet( “foobar” ) {a.set( “foo
links77
c++ boost bind signals member-function
Is it safe to use std::bind to pass a member function to boost::signals2::signal::connect()? In other words, is boost::bind and std::bind interchangeable?It compiles with VC++ 2010 SP1, but the template code is way over my head and I’m afraid I might be venturing into undefined behaviour territory.
Web site is in building