binary.hpp 433 B

123456789101112131415161718
  1. //
  2. // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
  3. // under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. #include "boost/mpl/long.hpp"
  8. #include "boost/mpl/alias.hpp"
  9. template< long n > struct binary
  10. : mpl::long_< ( binary< n / 10 >::value << 1 ) + n % 10 >
  11. {
  12. };
  13. template<> struct binary<0>
  14. : mpl::long_<0>
  15. {
  16. };