Modernize a bit <CGAL/array.h> assuming C++14

This commit is contained in:
Laurent Rineau 2021-02-03 21:51:00 +01:00
parent 8dbf50a94b
commit 9799879eef
1 changed files with 5 additions and 8 deletions

View File

@ -13,11 +13,7 @@
#define CGAL_ARRAY_H #define CGAL_ARRAY_H
#include <CGAL/config.h> #include <CGAL/config.h>
#ifndef CGAL_CFG_NO_CPP0X_ARRAY #include <array>
# include <array>
#else
# include <boost/array.hpp>
#endif
#include <utility> #include <utility>
namespace CGAL { namespace CGAL {
@ -50,8 +46,7 @@ namespace CGAL {
// It's also untrue that this is not documented... It is ! // It's also untrue that this is not documented... It is !
template< typename T, typename... Args > template< typename T, typename... Args >
inline constexpr std::array< T, 1 + sizeof...(Args) >
std::array< T, 1 + sizeof...(Args) >
make_array(const T & t, const Args & ... args) make_array(const T & t, const Args & ... args)
{ {
std::array< T, 1 + sizeof...(Args) > a = { { t, static_cast<T>(args)... } }; std::array< T, 1 + sizeof...(Args) > a = { { t, static_cast<T>(args)... } };
@ -63,7 +58,9 @@ make_array(const T & t, const Args & ... args)
struct Construct_array struct Construct_array
{ {
template <typename T, typename... Args> template <typename T, typename... Args>
std::array<T, 1 + sizeof...(Args)> operator()(const T& t, const Args& ... args) constexpr
std::array<T, 1 + sizeof...(Args)>
operator()(const T& t, const Args& ... args)
{ {
return make_array (t, args...); return make_array (t, args...);
} }