Half an hour ago, I discovered the variational parameters of the template, and now I'm fully connected.
I have a static class based abstraction for microcontroller output. I want to group multiple output pins so that I can handle them as one output. The code below works, but I think I would have to finish the recursion on 0 parameters, not 1.
template< typename pin, typename... tail_args > class tee { public: typedef tee< tail_args... > tail; static void set( bool b ){ pin::set( b ); tail::set( b ); } }; template< typename pin > class tee< pin > { public: static void set( bool b ){ pin::set( b ); } };
I tried this, but the compiler (gcc) does not seem to take this into account:
template<> class tee<> : public pin_output { public: static void set( bool b ){} };
The error message is long, but essentially says no tee <>. Something is wrong with my tee <> or it is not possible to complete the recursion
source share