title: boost::icl::interval and boost::numeric::interval is there an adaption layer available?
body: <p>I've been using <a href="https://www.boost.org/doc/libs/1_66_0/libs/numeric/interval/doc/interval.htm" rel="nofollow noreferrer">boost::numeric::interval</a> everywhere in my code. Now I've started using the <a href="https://www.boost.org/doc/libs/1_64_0/libs/icl/doc/html/index.html" rel="nofollow noreferrer">boost interval container library</a>. Does there exist an adaption header so I can put boost::numeric::interval intervals into boost::icl containers? </p>
  
  <p>I've tried the following code as advised in the <a href="https://www.boost.org/doc/libs/1_71_0/libs/icl/doc/html/boost_icl/examples/custom_interval.html" rel="nofollow noreferrer">customization docs</a> for boost::icl but it doesn't compile with many lines of template specialization failure messages. If you want to see the error messages you can try the live code at</p>
  
  <p><a href="https://wandbox.org/permlink/P8VzcdbjQQzf43yU" rel="nofollow noreferrer">https://wandbox.org/permlink/P8VzcdbjQQzf43yU</a></p>
  
  <p>The code I wrote is also below.</p>
  
  <p><strong>Adaption Code</strong></p>
  
  <pre><code>#include &lt;boost/icl/interval_set.hpp&gt;
  #include &lt;boost/numeric/interval.hpp&gt;
  
  namespace boost{ namespace icl
  {
  
  // Class template interval_traits serves as adapter to register and customize your interval class
  template&lt;typename T&gt;
  struct interval_traits&lt; boost::numeric::interval&lt;T&gt; &gt;       
  {                                                          
  
      typedef boost::numeric::interval&lt;T&gt;     interval_type;
      typedef T                               domain_type;                    
      typedef std::less&lt;T&gt;                    domain_compare;              
  
      static interval_type construct(const domain_type&amp; lo, const domain_type&amp; up)
      { return interval_type(lo, up); }
                                                              //3.2 Selection of values 
      static domain_type lower(const interval_type&amp; inter_val){ return inter_val.lower(); };
      static domain_type upper(const interval_type&amp; inter_val){ return inter_val.upper(); };
  };
  
  
  template&lt;typename T&gt;
  struct interval_bound_type&lt;boost::numeric::interval&lt;T&gt; &gt;                                   //4.  Finally we define the interval borders.
  {                                                                                          //    Choose between static_open         (lo..up)
      typedef interval_bound_type type;                                                      //                   static_left_open    (lo..up]
      BOOST_STATIC_CONSTANT(bound_type, value = boost::icl::interval_bounds::static_closed);
  };                                                                                         //               and static_closed       [lo..up] 
  
  }} // namespace boost icl
  </code></pre>
  
  <p><strong>Test Code</strong></p>
  
  <pre><code>int main()
  {
      boost::numeric::interval&lt;double&gt; i = boost::numeric::hull(1.0,2.0);
      boost::icl::interval_set&lt;double, std::less, boost::numeric::interval&lt;double&gt;&gt; iSet;
      iSet.insert(i);
  }
  
  </code></pre>