...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::icl::discrete_interval
// In header: <boost/icl/discrete_interval.hpp> template<typename DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)> class discrete_interval { public: // types typedef discrete_interval< DomainT, Compare > type; typedef DomainT domain_type; typedef bounded_value< DomainT >::type bounded_domain_type; // construct/copy/destruct discrete_interval(); explicit discrete_interval(const DomainT &); discrete_interval(const DomainT &, const DomainT &, interval_bounds = interval_bounds::right_open(), discrete_interval * = 0); // public member functions typedef ICL_COMPARE_DOMAIN(Compare, DomainT); domain_type lower() const; domain_type upper() const; interval_bounds bounds() const; // public static functions static discrete_interval open(const DomainT &, const DomainT &); static discrete_interval right_open(const DomainT &, const DomainT &); static discrete_interval left_open(const DomainT &, const DomainT &); static discrete_interval closed(const DomainT &, const DomainT &); };
discrete_interval
public
construct/copy/destructdiscrete_interval();
Default constructor; yields an empty interval [0,0)
.
explicit discrete_interval(const DomainT & val);
Constructor for a closed singleton interval [val,val]
discrete_interval(const DomainT & low, const DomainT & up, interval_bounds bounds = interval_bounds::right_open(), discrete_interval * = 0);
Interval from low
to up
with bounds bounds