Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: Kd Tree problem: cannot access Orthogonal_k_neighbor_search::Tree as it is private?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: Kd Tree problem: cannot access Orthogonal_k_neighbor_search::Tree as it is private?


Chronological Thread 
  • From: Philipp Moeller <>
  • To:
  • Subject: Re: [cgal-discuss] Re: Kd Tree problem: cannot access Orthogonal_k_neighbor_search::Tree as it is private?
  • Date: Tue, 27 Mar 2012 09:34:04 +0200
  • Organization: GeometryFactory

"Sebastien Loriot (GeometryFactory)"
<>
writes:

> On 03/27/2012 04:01 AM, freckles wrote:
>> Well, that's the weird thing. It's not reproducable in a minimal example as
>> it has worked before, it's just when a Kd_tree was added as a member object
>> in a *particular* class, it gave that compile error, which is why we don't
>> really know what to do about it.
>>
>> However when the following code in Kd_tree.h was turned public, it managed
>> to compile. It seems like a cheap and strange way to get it to work and I'm
>> not sure we'll ever know why it's so.
>>
>> i.e.
>> // protected copy constructor
>> public:
>> Kd_tree(const Tree& tree)
>> : built_(tree.built_)
>> {};
>>
>> Thanks anyway. :)
>
> The copy constructor is not public because it's not implemented for
> public use.
> If you have a compilation error, it's because you are trying to copy a
> class containing a kd-tree (which is not possible). You should use
> something like a reference or a (shared) pointer to your tree instead
> (if it makes sense for your application).
>
> Sebastien

Kd_tree should really derive from boost::non_copyable. That would (at
least on gcc) produce clearer error messages. We might also use

Kd_tree(const Tree& tree) = deleted;

on compilers that support it. Although I doubt users that are not
familiar with the error message already will know what it means.

--
Philipp Moeller
GeometryFactory



Archive powered by MHonArc 2.6.16.

Top of Page