Fix reference forwarding (+ property map error)

This commit is contained in:
Simon Giraudot 2017-07-12 10:22:52 +02:00
parent 0e440ff989
commit 45ffa0af52
2 changed files with 12 additions and 10 deletions

View File

@ -697,7 +697,7 @@ bool read_ply_points_with_properties (std::istream& stream,
OutputValueType new_element;
internal::PLY::process_properties (reader, new_element, properties...);
internal::PLY::process_properties (reader, new_element, std::forward<PropertyHandler>(properties)...);
*(output ++) = new_element;
@ -716,9 +716,9 @@ bool read_ply_points_with_properties (std::istream& stream,
PropertyHandler&& ... properties)
{
typedef typename value_type_traits<OutputIterator>::type OutputValueType;
return read_ply_points_with_properties<OutputValueType>
(stream, output, properties...);
(stream, output, std::forward<PropertyHandler>(properties)...);
}
/// \endcond

View File

@ -170,7 +170,8 @@ namespace internal {
PropertyHandler&& ... properties)
{
Properties_header<sizeof...(T)-1>::write(stream, current);
output_property_header (stream, next, properties...);
output_property_header (stream, std::forward<NextPropertyHandler>(next),
std::forward<PropertyHandler>(properties)...);
}
@ -188,10 +189,10 @@ namespace internal {
std::pair<PropertyMap, PLY_property<T> >&& map)
{
if (CGAL::get_mode(stream) == IO::ASCII)
stream << get (map, *it);
stream << get (map.first, *it);
else
{
typename PropertyMap::value_type value = get(map, *it);
typename PropertyMap::value_type value = get(map.first, *it);
stream.write (reinterpret_cast<char*>(&value), sizeof(value));
}
}
@ -243,7 +244,7 @@ namespace internal {
ForwardIterator it,
std::pair<PropertyMap, PLY_property<T> >&& current)
{
simple_property_write (stream, it, current);
simple_property_write (stream, it, std::forward<std::pair<PropertyMap, PLY_property<T> > >(current));
if (get_mode(stream) == IO::ASCII)
stream << std::endl;
}
@ -279,7 +280,8 @@ namespace internal {
property_write (stream, it, std::get<0>(current));
if (get_mode(stream) == IO::ASCII)
stream << " ";
output_properties (stream, it, next, properties...);
output_properties (stream, it, std::forward<NextPropertyHandler>(next),
std::forward<PropertyHandler>(properties)...);
}
} // namespace PLY
@ -340,7 +342,7 @@ write_ply_points_with_properties(
<< "comment Generated by the CGAL library" << std::endl
<< "element vertex " << std::distance (first, beyond) << std::endl;
internal::PLY::output_property_header (stream, properties...);
internal::PLY::output_property_header (stream, std::forward<PropertyHandler>(properties)...);
stream << "end_header" << std::endl;
@ -348,7 +350,7 @@ write_ply_points_with_properties(
// Write positions + normals
for(ForwardIterator it = first; it != beyond; it++)
{
internal::PLY::output_properties (stream, it, properties...);
internal::PLY::output_properties (stream, it, std::forward<PropertyHandler>(properties)...);
}
return ! stream.fail();