LINUX.ORG.RU

История изменений

Исправление quasimoto, (текущая версия) :

подружиться с лопатой, уже настоящей

Ну если from_one_to_thousand без вбивания всех чисел не получается сделать, то вполне можно рассмотреть этот вариант %)

template <typename I, I from, I to>
class Range;

using from_one_to_thousand = Range<int, 1, 1000>;

from_one_to_thousand::_<500>() // static_assert

from_one_to_thousand::_(500) // runtime check / option type (as in OCaml/SML/Haskell/boost/Scala/Java8/C#/F#/... ;))

Исправление quasimoto, :

подружиться с лопатой, уже настоящей

Ну если from_one_to_thousand без вбивания всех чисел не получается сделать, то вполне можно рассмотреть этот вариант %)

template <typename I, I from, I to>
class Range;

using from_one_to_thousand = Range<int, 1, 1000>;

from_one_to_thousand::_<500>() // static_assert

from_one_to_thousand::_(500) // runtime check / option type (as in OCaml/SML/Haskell/boost/Scala/Java8)

Исходная версия quasimoto, :

подружиться с лопатой, уже настоящей

Ну если from_one_to_thousand без вбивания всех чисел не получается сделать, то вполне можно рассмотреть этот вариант %)

template <typename I, I from, I to>
struct Range;

using from_one_to_thousand = Range<int, 1, 1000>;

from_one_to_thousand::_<500>() // static_assert

from_one_to_thousand::_(500) // runtime check / option type (as in OCaml/SML/Haskell/boost/Scala/Java8)