Opened 8 years ago

Last modified 7 years ago

#10895 new Bugs

graph - copy_component is broken

Reported by: erdem@… Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost 1.57.0 Severity: Problem
Keywords: graph copy_component Cc: erdem.cilingir@…

Description

I noticed two issues with copy_component in graph/copy.hpp.

  1. The non-named parameter version gives compiler error due to failing look up:
    return detail::copy_component_impl
      (g_in, src, g_out,
       make_vertex_copier(g_in, g_out), 
       make_edge_copier(g_in, g_out), 
       make_iterator_property_map(orig2copy.begin(), 
                                  get(vertex_index, g_in), orig2copy[0]),
       bgl_named_params<char,char>('x') // dummy param object
       );

error: 'make_vertex_copier' was not declared in this scope.

Prefixing them with detail:: solves this issue. This change makes it similar to copy_graph which also refers to the detail namespace for these functions.

Fixed version:

    return detail::copy_component_impl
      (g_in, src, g_out,
       detail::make_vertex_copier(g_in, g_out), 
       detail::make_edge_copier(g_in, g_out), 
       make_iterator_property_map(orig2copy.begin(), 
                                  get(vertex_index, g_in), orig2copy[0]),
       bgl_named_params<char,char>('x') // dummy param object
       );
  1. In graph_copy_visitor struct's copy_one_vertex member function, the template arguments include class Graph but it is not used (neither in the function arguments nor inside the func. body).
      template <class Vertex, class Graph>
      typename graph_traits<NewGraph>::vertex_descriptor copy_one_vertex(Vertex u) const { ... }

So the compiler complains about the failing deduction.

error: template argument deduction/substitution failed: note: couldn't deduce template parameter 'Graph'

Fix: Removing the template argument class Graph fixes the issue.

      template <class Vertex>
      typename graph_traits<NewGraph>::vertex_descriptor copy_one_vertex(Vertex u) const { ... }

Note: Tried with GCC 4.7.2 and 4.8.3

Attachments (1)

boost_copy_component.patch (990 bytes ) - added by ich.freak@… 7 years ago.
patch for convenience

Download all attachments as: .zip

Change History (2)

comment:1 by ich.freak@…, 7 years ago

I have the same problem, although I'm running 1.55.0, there were no changed to copy.hpp between 1.55.0 and 1.58.0 (which I understand is the latest version).

thanks

by ich.freak@…, 7 years ago

Attachment: boost_copy_component.patch added

patch for convenience

Note: See TracTickets for help on using tickets.