diff --git a/Interpolation/examples/Interpolation/linear_interpolation_of_vector_3.cpp b/Interpolation/examples/Interpolation/linear_interpolation_of_vector_3.cpp index 590dac81f34..5823a1f8799 100644 --- a/Interpolation/examples/Interpolation/linear_interpolation_of_vector_3.cpp +++ b/Interpolation/examples/Interpolation/linear_interpolation_of_vector_3.cpp @@ -11,48 +11,6 @@ typedef CGAL::Interpolation_traits_2 Traits; typedef K::Vector_3 Vector_3; typedef K::Point_2 Point_2; - -namespace boost { - -template -class value_initialized > -{ - private : - - typedef CGAL::Vector_3 T; - T m_data; - - public : - - value_initialized() - : - m_data(0,0,0) - { } - - T const & data() const - { - return m_data; - } - - T& data() - { - return m_data; - } - - operator T const &() const - { - return m_data; - } - - operator T&() - { - return m_data; - } -} ; - -} // nammespace boost - - int main() { Delaunay_triangulation T; @@ -65,14 +23,14 @@ int main() for (int y=0 ; y<255 ; y++){ for (int x=0 ; x<255 ; x++){ - K::Point_2_2 p(x,y); + K::Point_2 p(x,y); T.insert(p); value_function.insert(std::make_pair(p, Vector_3(x,y,1))); } } //coordinate computation - K::Point_2_2 p(1.3, 0.34); + K::Point_2 p(1.3, 0.34); std::vector > coords; double norm = CGAL::natural_neighbor_coordinates_2(T, p, std::back_inserter(coords)).second; diff --git a/Interpolation/include/CGAL/interpolation_functions.h b/Interpolation/include/CGAL/interpolation_functions.h index 8d5e4565425..e75569cffda 100644 --- a/Interpolation/include/CGAL/interpolation_functions.h +++ b/Interpolation/include/CGAL/interpolation_functions.h @@ -26,9 +26,9 @@ #include #include #include +#include #include -#include #include #include #include @@ -65,7 +65,6 @@ typename boost::result_of< ::type::first_type linear_interpolation(ForwardIterator first, ForwardIterator beyond, const typename std::iterator_traits::value_type::second_type& norm, - //const Norm& norm, ValueFunctor value_function) { CGAL_precondition(norm > 0); @@ -74,13 +73,13 @@ linear_interpolation(ForwardIterator first, ForwardIterator beyond, typedef typename boost::result_of::type result_type; typedef typename result_type::first_type Value_type; - boost::value_initialized result; + Value_type result = make_zero(); result_type val; for(; first!=beyond; ++first) { val = value_function(first->first); CGAL_assertion(val.second); - get(result) += (first->second / norm) * val.first; + result += (first->second / norm) * val.first; } return result; } diff --git a/Kernel_23/include/CGAL/Vector_2.h b/Kernel_23/include/CGAL/Vector_2.h index 1b37a2c24d9..fdc88269739 100644 --- a/Kernel_23/include/CGAL/Vector_2.h +++ b/Kernel_23/include/CGAL/Vector_2.h @@ -35,6 +35,7 @@ #include #include #include +#include #include namespace CGAL { @@ -389,6 +390,15 @@ operator>>(std::istream& is, Vector_2& v) return extract(is, v, typename R::Kernel_tag() ); } +template +struct Make_zero > +{ + Vector_2 operator()() const + { + return CGAL::NULL_VECTOR; + } + +}; } //namespace CGAL #endif // CGAL_VECTOR_2_H diff --git a/Kernel_23/include/CGAL/Vector_3.h b/Kernel_23/include/CGAL/Vector_3.h index 82818e8d229..5506c853d8a 100644 --- a/Kernel_23/include/CGAL/Vector_3.h +++ b/Kernel_23/include/CGAL/Vector_3.h @@ -35,6 +35,7 @@ #include #include #include +#include #include namespace CGAL { @@ -371,6 +372,16 @@ operator>>(std::istream& is, Vector_3& v) return extract(is, v, typename R::Kernel_tag() ); } + +template +struct Make_zero > +{ + Vector_3 operator()() const + { + return CGAL::NULL_VECTOR; + } +}; + } //namespace CGAL #endif // CGAL_VECTOR_3_H diff --git a/Kernel_23/include/CGAL/make_zero.h b/Kernel_23/include/CGAL/make_zero.h new file mode 100644 index 00000000000..fe160f17c35 --- /dev/null +++ b/Kernel_23/include/CGAL/make_zero.h @@ -0,0 +1,48 @@ +// Copyright (c) 2018 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Andreas Fabri + +#ifndef CGAL_MAKE_ZERO_H +#define CGAL_MAKE_ZERO_H + +namespace CGAL { + +template +struct Make_zero { + T operator()()const + { + return T(); + } +}; + +template +T make_zero() +{ + Make_zero mz; + return mz(); +} + +} //namespace CGAL + +#endif // CGAL_MAKE_ZERO_H