[Boost-bugs] [Boost C++ Libraries] #10003: Fibonacci heaps base class not copy constructible.

Subject: [Boost-bugs] [Boost C++ Libraries] #10003: Fibonacci heaps base class not copy constructible.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-03 08:29:09


#10003: Fibonacci heaps base class not copy constructible.
------------------------------+--------------------------
 Reporter: renficiaud | Owner: timblechmann
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: heap
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: |
------------------------------+--------------------------
 The following code does not compile on Windows / Visual Express 2013 x64.

 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!C++
 BOOST_AUTO_TEST_CASE(test_heap_vector)
 {
   typedef boost::heap::fibonacci_heap<double, boost::heap::compare<
 std::less<double> > > low_heap_t;

   low_heap_t lowh;

   const int K = 7;

   boost::random::uniform_real_distribution<double> dist;
   // preparing the heap
   for(int i = 0; i < 100; i++)
   {
     double current = dist(rng);
     if(lowh.size() < K)
     {
       lowh.push(current);
     }
     else if(lowh.value_comp()(current, lowh.top()))
     {
       lowh.push(current);
       lowh.pop();
     }
   }

   BOOST_CHECK_EQUAL(lowh.size(), K);

   // duplicating in the vector
   std::vector<low_heap_t> v(10, lowh);
   for(int i = 0; i < 10; i++)
   {
     BOOST_CHECK_EQUAL(v[i].size(), K);
   }
 }
   }}}
 }}}

 The compiler gives me this:
 {{{
 1>d:\Code\thirdparties\visual2013x64\boost_1_55\include\boost-
 1_55\boost/heap/fibonacci_heap.hpp(224): error C2664:
 'boost::heap::detail::make_fibonacci_heap_base<T,boost::parameter::aux::arg_list<boost::heap::compare<std::less<double>>,ArgumentPack>>::type::type(boost::heap::detail::make_fibonacci_heap_base<T,boost::parameter::aux::arg_list<boost::heap::compare<std::less<double>>,ArgumentPack>>::type
 &)' : impossible de convertir l'argument 1 de 'const
 boost::heap::fibonacci_heap<double,boost::heap::compare<std::less<double>>,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_>'
 en 'const std::less<double> &'
 1> with
 1> [
 1> T=double
 1> , ArgumentPack=boost::parameter::aux::empty_arg_list
 1> ]
 1> Raison : impossible de convertir de 'const
 boost::heap::fibonacci_heap<double,boost::heap::compare<std::less<double>>,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_>'
 en 'const std::less<double>'
 1> Aucun opérateur de conversion définie par l'utilisateur
 disponible qui puisse effectuer cette conversion, ou l'opérateur ne peut
 pas être appelé
 1> d:\Code\thirdparties\visual2013x64\boost_1_55\include\boost-
 1_55\boost/heap/fibonacci_heap.hpp(222) : lors de la compilation de la
 fonction membre
 'boost::heap::fibonacci_heap<double,boost::heap::compare<std::less<double>>,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_>::fibonacci_heap(const
 boost::heap::fibonacci_heap<double,boost::heap::compare<std::less<double>>,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_>
 &)' de la classe modèle
 1> C:\Program Files (x86)\Microsoft Visual Studio
 12.0\VC\include\xmemory0(593) : voir la référence à l'instanciation de la
 fonction modèle
 'boost::heap::fibonacci_heap<double,boost::heap::compare<std::less<double>>,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_>::fibonacci_heap(const
 boost::heap::fibonacci_heap<double,boost::heap::compare<std::less<double>>,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_>
 &)' en cours de compilation
 ========== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été
 ignoré ==========
 }}}


 Apparently it comes from

 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!C++
     make_fibonacci_heap_base::type
   }}}
 }}}


 Creating a copy constructor and moving the assignment operator out of the
 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES / #endif seems to work.



 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!C++
     struct type:
         base_type,
         allocator_type
     {
         type(compare_argument const & arg):
             base_type(arg)
         {}
         type(type const & rhs):
             base_type(static_cast<base_type const &>(rhs)),
             allocator_type(static_cast<allocator_type const&>(rhs))
         {}
 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
         type(type && rhs):
             base_type(std::move(static_cast<base_type&>(rhs))),
             allocator_type(std::move(static_cast<allocator_type&>(rhs)))
         {}

         type(type & rhs):
             base_type(static_cast<base_type&>(rhs)),
             allocator_type(static_cast<allocator_type&>(rhs))
         {}

         type & operator=(type && rhs)
         {
             base_type::operator=(std::move(static_cast<base_type&>(rhs)));
 allocator_type::operator=(std::move(static_cast<allocator_type&>(rhs)));
             return *this;
         }
 #endif
         type & operator=(type const & rhs)
         {
             base_type::operator=(static_cast<base_type const &>(rhs));
             allocator_type::operator=(static_cast<allocator_type const
 &>(rhs));
             return *this;
         }

     };
   }}}
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10003>
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:16 UTC