Subject: CGAL users discussion list
List archive
- From: Philipp Moeller <>
- To:
- Subject: Re: [cgal-discuss] Initializing Vector of Point and Normal Pairs
- Date: Mon, 12 Dec 2011 13:15:02 +0100
std::transform from the algorithm header seems to fit your needs:
std::transform(point_vector1.begin(), point_vector1.end(),
std::back_inserter(pointsnvectors), [](const Vector_3& v)
{ return std::make_pair(v, Vector_3()); });
It also has a binary form in case you need to zip two different
sequences into a sequence of corresponding pairs.
You would need to use a functor or boost::bind (std::bind2nd) to get
something similar on a compiler that does not support lambdas.
--
Philipp
ingfu
<>
writes:
> Hey,
>
> I was wondering if there exists a more convenient way to initialize a vector
> of point and (empty) normal pairs than
>
> std::list<PointVectorPair> pointsnvectors;
>
> int size = point_vector1->size();
>
> for(int i = 0; i<size; i++) {
> pointsnvectors.push_back(PointVectorPair(point_vector1->at(i),
> Vector_3()));
> }
>
>
> --
> View this message in context:
> http://cgal-discuss.949826.n4.nabble.com/Initializing-Vector-of-Point-and-Normal-Pairs-tp4185628p4185628.html
> Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Initializing Vector of Point and Normal Pairs, ingfu, 12/12/2011
- Re: [cgal-discuss] Initializing Vector of Point and Normal Pairs, Philipp Moeller, 12/12/2011
Archive powered by MHonArc 2.6.16.