ProAnswers.org

How to Print 1 to 1000 without loop or conditionals in c++?

#include
template
struct NumberGeneration{
static void out(std::ostream& os)
{
NumberGeneration::out(os);
os << N << std::endl;
}
};
template<>
struct NumberGeneration<1>{
static void out(std::ostream& os)
{
os << 1 << std::endl;
}
};
int main(){
NumberGeneration<1000>::out(std::cout);
}