委譲コンストラクタでFizzBuzzっぽいの

コンストラクタって強力ですね

#include <iostream>
#include <type_traits>
#include <sprout/index_tuple.hpp>

extern void* enabler;

template<std::size_t N, std::size_t M>
struct fizzbuzz
{
  fizzbuzz()
    : fizzbuzz(sprout::index_range<N, M>::make()) {};

  template<
    sprout::index_t I,
    sprout::index_t... Indices,
    typename std::enable_if<(I < M && I % 3 != 0 && I % 5 != 0 && sizeof...(Indices) != 0 )>::type*& = enabler
  >
  fizzbuzz(sprout::index_tuple<I, Indices...>)
    : fizzbuzz(sprout::index_tuple<Indices...>())
  {
    std::cout << I << std::endl;
  };

  template<
    sprout::index_t I,
    sprout::index_t... Indices,
    typename std::enable_if<(I < M && I % 3 == 0 && I % 5 != 0 && sizeof...(Indices) != 0)>::type*& = enabler
  >
  fizzbuzz(sprout::index_tuple<I, Indices...>)
    : fizzbuzz(sprout::index_tuple<Indices...>())
  {
    std::cout << "fizz" << std::endl;
  };

  template<
    sprout::index_t I,
    sprout::index_t... Indices,
    typename std::enable_if<(I < M && I % 3 != 0 && I % 5 == 0 && sizeof...(Indices) != 0)>::type*& = enabler  
  >
  fizzbuzz(sprout::index_tuple<I, Indices...>)
    : fizzbuzz(sprout::index_tuple<Indices...>())
  {
    std::cout << "buzz" << std::endl;
  };

  template<
    sprout::index_t I,
    sprout::index_t... Indices,
    typename std::enable_if<(I < M && I % 3 == 0 && I % 5 == 0 && sizeof...(Indices) != 0)>::type*& = enabler  
  >
  fizzbuzz(sprout::index_tuple<I, Indices...>)
    : fizzbuzz(sprout::index_tuple<Indices...>())
  {
    std::cout << "fizzbuzz" << std::endl;
  };

  template<
    sprout::index_t I,
    sprout::index_t... Indices,
    typename std::enable_if<(I % 3 != 0 && I % 5 != 0 && sizeof...(Indices) == 0)>::type*& = enabler
  >
  fizzbuzz(sprout::index_tuple<I, Indices...>)
  {
    std::cout << I << std::endl;
  };

  template<
    sprout::index_t I,
    sprout::index_t... Indices,
    typename std::enable_if<(I % 3 == 0 && I % 5 != 0 && sizeof...(Indices) == 0)>::type*& = enabler
  >
  fizzbuzz(sprout::index_tuple<I, Indices...>)
  {
    std::cout << "fizz" << std::endl;
  };


  template<
    sprout::index_t I,
    sprout::index_t... Indices,
    typename std::enable_if<(I % 3 != 0 && I % 5 == 0 && sizeof...(Indices) == 0)>::type*& = enabler
  >
  fizzbuzz(sprout::index_tuple<I, Indices...>)
  {
    std::cout << "buzz" << std::endl;
  };

 template<
    sprout::index_t I,
    sprout::index_t... Indices,
    typename std::enable_if<(I % 3 == 0 && I % 5 == 0 && sizeof...(Indices) == 0)>::type*& = enabler
  >
  fizzbuzz(sprout::index_tuple<I, Indices...>)
  {
    std::cout << "fizzbuzz" << std::endl;
  };
};

int main()
{
  fizzbuzz<0, 100>();
}