/
usr
/
include
/
boost
/
icl
/
/usr/include/boost/icl
mkdir
upload
Name
Size
Mode
Actions
concept/
-
0755
rm
detail/
-
0755
rm
predicates/
-
0755
rm
type_traits/
-
0755
rm
associative_element_container.hpp
862
0644
edit
dl
rm
associative_interval_container.hpp
997
0644
edit
dl
rm
closed_interval.hpp
4252
0644
edit
dl
rm
continuous_interval.hpp
7148
0644
edit
dl
rm
discrete_interval.hpp
6991
0644
edit
dl
rm
dynamic_interval_traits.hpp
1306
0644
edit
dl
rm
functors.hpp
16489
0644
edit
dl
rm
gregorian.hpp
4225
0644
edit
dl
rm
impl_config.hpp
3119
0644
edit
dl
rm
interval.hpp
5983
0644
edit
dl
rm
interval_base_map.hpp
56699
0644
edit
dl
rm
interval_base_set.hpp
22501
0644
edit
dl
rm
interval_bounds.hpp
2893
0644
edit
dl
rm
interval_combining_style.hpp
945
0644
edit
dl
rm
interval_map.hpp
11872
0644
edit
dl
rm
interval_set.hpp
8124
0644
edit
dl
rm
interval_traits.hpp
1900
0644
edit
dl
rm
iterator.hpp
3742
0644
edit
dl
rm
left_open_interval.hpp
4505
0644
edit
dl
rm
map.hpp
26282
0644
edit
dl
rm
open_interval.hpp
4442
0644
edit
dl
rm
ptime.hpp
4317
0644
edit
dl
rm
rational.hpp
2219
0644
edit
dl
rm
right_open_interval.hpp
4422
0644
edit
dl
rm
separate_interval_set.hpp
7928
0644
edit
dl
rm
set.hpp
873
0644
edit
dl
rm
split_interval_map.hpp
10593
0644
edit
dl
rm
split_interval_set.hpp
8616
0644
edit
dl
rm
Edit:
/usr/include/boost/icl/discrete_interval.hpp
(6991B)
/*-----------------------------------------------------------------------------+ Copyright (c) 2010-2010: Joachim Faulhaber +------------------------------------------------------------------------------+ 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) +-----------------------------------------------------------------------------*/ #ifndef BOOST_ICL_DISCRETE_INTERVAL_HPP_JOFA_100403 #define BOOST_ICL_DISCRETE_INTERVAL_HPP_JOFA_100403 #include <functional> #include <boost/static_assert.hpp> #include <boost/concept/assert.hpp> #include <boost/icl/detail/concept_check.hpp> #include <boost/icl/type_traits/succ_pred.hpp> #include <boost/icl/concept/interval.hpp> #include <boost/icl/type_traits/value_size.hpp> #include <boost/icl/type_traits/type_to_string.hpp> #include <boost/icl/type_traits/is_continuous.hpp> #include <boost/icl/type_traits/is_discrete_interval.hpp> #include <boost/icl/interval_bounds.hpp> namespace boost{namespace icl { template <class DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)> class discrete_interval { public: typedef discrete_interval<DomainT,Compare> type; typedef DomainT domain_type; typedef ICL_COMPARE_DOMAIN(Compare,DomainT) domain_compare; typedef typename bounded_value<DomainT>::type bounded_domain_type; public: //========================================================================== //= Construct, copy, destruct //========================================================================== /** Default constructor; yields an empty interval <tt>[0,0)</tt>. */ discrete_interval() : _lwb(identity_element<DomainT>::value()), _upb(identity_element<DomainT>::value()) , _bounds(interval_bounds::right_open()) { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); BOOST_STATIC_ASSERT((icl::is_discrete<DomainT>::value)); } //NOTE: Compiler generated copy constructor is used /** Constructor for a closed singleton interval <tt>[val,val]</tt> */ explicit discrete_interval(const DomainT& val) : _lwb(val), _upb(val), _bounds(interval_bounds::closed()) { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); BOOST_STATIC_ASSERT((icl::is_discrete<DomainT>::value)); } /** Interval from <tt>low</tt> to <tt>up</tt> with bounds <tt>bounds</tt> */ discrete_interval(const DomainT& low, const DomainT& up, interval_bounds bounds = interval_bounds::right_open(), discrete_interval* = 0) : _lwb(low), _upb(up), _bounds(bounds) { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); BOOST_STATIC_ASSERT((icl::is_discrete<DomainT>::value)); } domain_type lower()const { return _lwb; } domain_type upper()const { return _upb; } interval_bounds bounds()const{ return _bounds; } static discrete_interval open (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::open()); } static discrete_interval right_open(const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::right_open());} static discrete_interval left_open (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::left_open()); } static discrete_interval closed (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::closed()); } private: domain_type _lwb; domain_type _upb; interval_bounds _bounds; }; //============================================================================== //=T discrete_interval -> concept intervals //============================================================================== template<class DomainT, ICL_COMPARE Compare> struct interval_traits< icl::discrete_interval<DomainT, Compare> > { typedef interval_traits type; typedef DomainT domain_type; typedef ICL_COMPARE_DOMAIN(Compare,DomainT) domain_compare; typedef icl::discrete_interval<DomainT, Compare> interval_type; static interval_type construct(const domain_type& lo, const domain_type& up) { return interval_type(lo, up); } static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); } static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); } }; //============================================================================== //=T discrete_interval -> concept dynamic_interval_traits //============================================================================== template<class DomainT, ICL_COMPARE Compare> struct dynamic_interval_traits<boost::icl::discrete_interval<DomainT,Compare> > { typedef dynamic_interval_traits type; typedef boost::icl::discrete_interval<DomainT,Compare> interval_type; typedef DomainT domain_type; typedef ICL_COMPARE_DOMAIN(Compare,DomainT) domain_compare; static interval_type construct(const domain_type& lo, const domain_type& up, interval_bounds bounds) { return interval_type(lo, up, bounds, static_cast<interval_type*>(0) ); } static interval_type construct_bounded(const bounded_value<DomainT>& lo, const bounded_value<DomainT>& up) { return interval_type ( lo.value(), up.value(), lo.bound().left() | up.bound().right(), static_cast<interval_type* >(0) ); } }; //============================================================================== //= Type traits //============================================================================== template <class DomainT, ICL_COMPARE Compare> struct interval_bound_type< discrete_interval<DomainT,Compare> > { typedef interval_bound_type type; BOOST_STATIC_CONSTANT(bound_type, value = interval_bounds::dynamic); }; template <class DomainT, ICL_COMPARE Compare> struct is_discrete_interval<discrete_interval<DomainT,Compare> > { typedef is_discrete_interval<discrete_interval<DomainT,Compare> > type; BOOST_STATIC_CONSTANT(bool, value = is_discrete<DomainT>::value); }; template <class DomainT, ICL_COMPARE Compare> struct type_to_string<icl::discrete_interval<DomainT,Compare> > { static std::string apply() { return "dI<"+ type_to_string<DomainT>::apply() +">"; } }; template<class DomainT> struct value_size<icl::discrete_interval<DomainT> > { static std::size_t apply(const icl::discrete_interval<DomainT>&) { return 2; } }; }} // namespace icl boost #endif
Save
cmd:
run