/*-----------------------------------------------------------------------------+ Interval Container Library Author: Joachim Faulhaber Copyright (c) 2007-2010: Joachim Faulhaber Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin +------------------------------------------------------------------------------+ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENCE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +-----------------------------------------------------------------------------*/ /** Example dynamic_interval.cpp \file dynamic_interval.cpp \brief Intervals with dynamic interval bounds that can be changed at runtime. Intervals types with dynamic interval bounds can represent closed and open interval borders. Interval borders are not static or fixed for the type but may change due to computations in interval containers. Dynamically bounded intervals are the library default for interval parameters in interval containers. \include dynamic_interval_/dynamic_interval.cpp */ //[example_dynamic_interval #include #include #include #include #include #include // Dynamically bounded intervals 'discrete_interval' and 'continuous_interval' // are indirectly included via interval containers as library defaults. #include "../toytime.hpp" #include using namespace std; using namespace boost; using namespace boost::icl; int main() { cout << ">>Interval Container Library: Sample interval.cpp <<\n"; cout << "----------------------------------------------------\n"; // Dynamically bounded intervals are the library default for // interval parameters in interval containers. BOOST_STATIC_ASSERT(( boost::is_same< interval_set::interval_type , discrete_interval >::value )); BOOST_STATIC_ASSERT(( boost::is_same< interval_set::interval_type , continuous_interval >::value )); // As we can see the library default chooses the appropriate // class template instance discrete_interval or continuous_interval // dependent on the domain_type T. The library default for intervals // is also available via the template 'interval': BOOST_STATIC_ASSERT(( boost::is_same< interval::type , discrete_interval >::value )); BOOST_STATIC_ASSERT(( boost::is_same< interval::type , continuous_interval >::value )); // template interval also provides static functions for the four border types interval::type int_interval = interval::closed(3, 7); interval::type sqrt_interval = interval::right_open(1/sqrt(2.0), sqrt(2.0)); interval::type city_interval = interval::left_open("Barcelona", "Boston"); interval