   Using Boost
  So for this small program :template<int N>struct Binary{enum{ result = Binary<N/10>::result << 1 | N % 10 };};template<>struct Binary<0>{enum{ result = 0};};returns the value of the binary sequence number N. For example, Binary<100>::result equals 4, and Binary<1010>::result equals 10. So thetask now is to use BOOST_STATIC_ASSERT to check if the binary number passedin Binary consists of only 1's and 0's. To do this I made this program,template<int N>struct Binary{BOOST_STATIC_ASSERT( (isBinarySequence<N>::result) );enum{ result = Binary<N/10>::result << 1 | N % 10 };};template<>struct Binary<0>{enum{ result = 0};};Where isBinarySequence is a meta function that checks if N consists of only 1's and 0's. I was wondering if we could avoid writing the isBinarySequence<N>metafunction and use the static assert somehow to assert N is only a compoundstatement of 1's and 0's.    
Quote:N % 10Digit must be either 0 or 1. Modulo is what calculates the digit.template < int N > struct ModAndTest    { /* no result here */ };template <  > struct ModAndTest<1> { enum { result = 1 }; };template <  > struct ModAndTest<0> { enum { result = 0 }; };And the original becomes:enum{ result = Binary<N/10>::result << 1 | ModAndTest<N % 10>::result };