Re: [Boost-bugs] [Boost C++ Libraries] #5207: ICL compile errors

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5207: ICL compile errors
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-02-22 07:46:10


#5207: ICL compile errors
------------------------------------------------------+---------------------
  Reporter: John Reid <j.reid@…> | Owner: jofaber
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: ICL
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
------------------------------------------------------+---------------------

Comment (by jofaber):

 I am replying to your ticket #5207 on the lists because I am afraid
 that you walked into a trap that others can fall into as well.

 In the ITL, the precursor of Boost.ICL there was a single polymorphic
 interval class template: itl::interval. Due to input from the list
 during the review I split up this "one size fit's all" template in
 smaller classes according to static and dynamic interval concepts.

 In order to help ITL users to have a simple transition from ITL to ICL
 I wrote a template icl::interval. icl::interval is a meta function
 that yields the right interval type dependent on the instance type
 e.g. :

 {{{#!c++
 BOOST_STATIC_ASSERT((
    boost::is_same< interval<int>::type
                  , discrete_interval<int> >::value
                  ));
 }}}

 So ITL users could move from ITL to ICL just by appending a `::type`
 to all occurrences of `interval<T>`

 So please note that
 {{{#!c++
 icl::interval<myType> myInterval;
 }}}

 can '''not''' be used as an interval type in ICL functions.

 Please use
 {{{#!c++
 icl::interval<myType>::type myInterval;
 }}}

 or one of the specific interval types

 `discrete_interval, continuous_interval,` (dynamic borders)

 `closed_interval, right_open_interval,`
 `left_open_interval, open_interval` (static borders)

 e.g.
 `discrete_interval<int> myInterval;`

 See examples
 http://www.joachim-
 faulhaber.de/boost_icl/doc/libs/icl/doc/html/boost_icl/examples/interval.html

 http://www.joachim-
 faulhaber.de/boost_icl/doc/libs/icl/doc/html/boost_icl/examples/dynamic_interval.html

 http://www.joachim-
 faulhaber.de/boost_icl/doc/libs/icl/doc/html/boost_icl/examples/static_interval.html


 and docs
 http://www.joachim-
 faulhaber.de/boost_icl/doc/libs/icl/doc/html/boost_icl/interface.html#boost_icl.interface.class_templates

 for more detail.

 This reduces John's non compilable ICL statements in the following way:

 {{{#!c++
 BOOST_AUTO_TEST_CASE(ticket_5207)
 {
  icl::interval< int >::type int_interval;
  icl::interval_set< int > int_set;
  icl::interval_map< int, int > int_map;
  icl::interval_map< int, int >::element_type int_element;
  icl::interval_map< int, int >::segment_type int_segment;

  // The next 4 lines compile
  icl::lower( int_interval );
  icl::upper( int_interval );
  icl::first( int_interval );
  icl::last( int_interval );

  // The next 4 lines are *not* supposed to compile
  // according to the docs:
  icl::add( int_set, int_set );
  icl::add( int_map, int_map );
  icl::subtract( int_set, int_set );
  icl::subtract( int_map, int_map );

  int_set += int_interval; // compiles

  // Here you are right, John:
  // The next 4 lines should compile according
  // to the docs, but don't
  icl::disjoint( int_map, int_element );
  icl::disjoint( int_map, int_segment );
  icl::intersects( int_map, int_segment );
  icl::intersects( int_map, int_element );
 }
 }}}
 Thanks for using my library and helping to improve it.
 Joachim

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5207#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC