Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Kd_tree move constructible

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Kd_tree move constructible


Chronological Thread 
  • From: Marc Glisse <>
  • To:
  • Subject: Re: [cgal-discuss] Kd_tree move constructible
  • Date: Wed, 25 Nov 2015 18:52:03 +0100 (CET)

On Wed, 25 Nov 2015, Bart Vermeulen wrote:

I'm trying to use c++11 threads with a Kd_tree.

I have a function which takes a Kd_Tree as input:

void foo (Tree const & tree, ...) {
// Do something
}

Than I try to pass the function to a std::thread construction:

std::thread thethread(foo, tree, ...);

This gives me an error telling me that the constructor Kd_tree(const Tree& tree) is private.

The std::thread construction requires all parameters to be move constructible, but why is this construction private for a Kd_tree?

Is there some way around this issue?

http://en.cppreference.com/w/cpp/utility/functional/reference_wrapper


On Wed, 25 Nov 2015, Bart Vermeulen wrote:

I solved the issue passing a pointer to the tree, instead of a reference.

Still I think it's strange that the copy construction is made private in Kd_tree.

How often do you actually want a copy of a kd-tree? If you are doing the copy by accident, or because you don't know the right syntax, it is good that you get some error about it.

--
Marc Glisse



Archive powered by MHonArc 2.6.18.

Top of Page