coord: use std::size_t over size_t
This commit is contained in:
parent
3799135236
commit
c4e367e648
@ -11,11 +11,11 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
*
|
||||||
* Copyright 2012-2016 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2012-2017 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __UTIL_COORD_BASE_HPP
|
#ifndef CRUFT_UTIL_COORD_BASE_HPP
|
||||||
#define __UTIL_COORD_BASE_HPP
|
#define CRUFT_UTIL_COORD_BASE_HPP
|
||||||
|
|
||||||
#include "init.hpp"
|
#include "init.hpp"
|
||||||
|
|
||||||
@ -29,9 +29,9 @@
|
|||||||
namespace util::coord {
|
namespace util::coord {
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t, typename> class KLASS,
|
template <std::size_t, typename> class KLASS,
|
||||||
typename ...tags
|
typename ...tags
|
||||||
>
|
>
|
||||||
struct base : public init<S,T,tags...> {
|
struct base : public init<S,T,tags...> {
|
||||||
@ -39,11 +39,11 @@ namespace util::coord {
|
|||||||
static_assert (std::is_arithmetic<T>::value);
|
static_assert (std::is_arithmetic<T>::value);
|
||||||
|
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
static constexpr size_t dimension = S;
|
static constexpr std::size_t dimension = S;
|
||||||
static constexpr size_t elements = S;
|
static constexpr std::size_t elements = S;
|
||||||
|
|
||||||
/// returns the number of elements we contain
|
/// returns the number of elements we contain
|
||||||
static constexpr size_t size (void) { return S; }
|
static constexpr std::size_t size (void) { return S; }
|
||||||
|
|
||||||
// inherit the fancy elementwise constructors from `init'.
|
// inherit the fancy elementwise constructors from `init'.
|
||||||
using init<S,T,tags...>::init;
|
using init<S,T,tags...>::init;
|
||||||
@ -67,8 +67,8 @@ namespace util::coord {
|
|||||||
base& operator= (const base<S,T,KLASS,tags...> &rhs) = default;
|
base& operator= (const base<S,T,KLASS,tags...> &rhs) = default;
|
||||||
|
|
||||||
// element accessors
|
// element accessors
|
||||||
T& operator[] (size_t i) { return this->data[i]; }
|
T& operator[] (std::size_t i) { return this->data[i]; }
|
||||||
constexpr const T& operator[] (size_t i) const { return this->data[i]; }
|
constexpr const T& operator[] (std::size_t i) const { return this->data[i]; }
|
||||||
|
|
||||||
auto cbegin (void) const { return std::cbegin (this->data); }
|
auto cbegin (void) const { return std::cbegin (this->data); }
|
||||||
auto cend (void) const { return std::cend (this->data); }
|
auto cend (void) const { return std::cend (this->data); }
|
||||||
@ -87,7 +87,7 @@ namespace util::coord {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
// conversions
|
// conversions
|
||||||
template <template <size_t, typename> class K>
|
template <template <std::size_t, typename> class K>
|
||||||
K<S,T> as (void) const
|
K<S,T> as (void) const
|
||||||
{
|
{
|
||||||
K<S,T> k;
|
K<S,T> k;
|
||||||
|
@ -11,17 +11,19 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
*
|
||||||
* Copyright 2016 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2016-2017 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __UTIL_COORD_FWD_HPP
|
#ifndef CRUFT_UTIL_COORD_FWD_HPP
|
||||||
#define __UTIL_COORD_FWD_HPP
|
#define CRUFT_UTIL_COORD_FWD_HPP
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
template <size_t,typename> struct colour;
|
template <std::size_t,typename> struct colour;
|
||||||
template <size_t,typename> struct extent;
|
template <std::size_t,typename> struct extent;
|
||||||
template <size_t,typename> struct point;
|
template <std::size_t,typename> struct point;
|
||||||
template <size_t,typename> struct vector;
|
template <std::size_t,typename> struct vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,15 +14,15 @@
|
|||||||
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __UTIL_COORD_INIT_HPP
|
#ifndef CRUFT_UTIL_COORD_INIT_HPP
|
||||||
#define __UTIL_COORD_INIT_HPP
|
#define CRUFT_UTIL_COORD_INIT_HPP
|
||||||
|
|
||||||
#include "store.hpp"
|
#include "store.hpp"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace util::coord {
|
namespace util::coord {
|
||||||
template <size_t S, typename T, typename...>
|
template <std::size_t S, typename T, typename...>
|
||||||
struct init;
|
struct init;
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -11,21 +11,22 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
*
|
||||||
* Copyright 2016 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2016-2017 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __UTIL_IOSTREAM
|
#ifndef CRUFT_UTIL_IOSTREAM
|
||||||
#define __UTIL_IOSTREAM
|
#define CRUFT_UTIL_IOSTREAM
|
||||||
|
|
||||||
#include "../iterator.hpp"
|
#include "../iterator.hpp"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
template <
|
template <
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T
|
typename T
|
||||||
>
|
>
|
||||||
std::ostream&
|
std::ostream&
|
||||||
@ -40,7 +41,6 @@ namespace util {
|
|||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __UTIL_COORD_NAMES_HPP
|
#ifndef CRUFT_UTIL_COORD_NAMES_HPP
|
||||||
#define __UTIL_COORD_NAMES_HPP
|
#define CRUFT_UTIL_COORD_NAMES_HPP
|
||||||
|
|
||||||
namespace util::coord {
|
namespace util::coord {
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
262
coord/ops.hpp
262
coord/ops.hpp
@ -35,39 +35,39 @@ namespace util {
|
|||||||
// operation traits
|
// operation traits
|
||||||
namespace coord {
|
namespace coord {
|
||||||
template <
|
template <
|
||||||
template <size_t,typename> class A,
|
template <std::size_t,typename> class A,
|
||||||
template <size_t,typename> class B
|
template <std::size_t,typename> class B
|
||||||
>
|
>
|
||||||
struct result { };
|
struct result { };
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <> struct result<colour,colour> { template <size_t S, typename T> using type = colour<S,T>; };
|
template <> struct result<colour,colour> { template <std::size_t S, typename T> using type = colour<S,T>; };
|
||||||
template <> struct result<extent,extent> { template <size_t S, typename T> using type = extent<S,T>; };
|
template <> struct result<extent,extent> { template <std::size_t S, typename T> using type = extent<S,T>; };
|
||||||
template <> struct result<extent,vector> { template <size_t S, typename T> using type = extent<S,T>; };
|
template <> struct result<extent,vector> { template <std::size_t S, typename T> using type = extent<S,T>; };
|
||||||
template <> struct result<point,extent> { template <size_t S, typename T> using type = point <S,T>; };
|
template <> struct result<point,extent> { template <std::size_t S, typename T> using type = point <S,T>; };
|
||||||
template <> struct result<point,vector> { template <size_t S, typename T> using type = point <S,T>; };
|
template <> struct result<point,vector> { template <std::size_t S, typename T> using type = point <S,T>; };
|
||||||
template <> struct result<vector,point> { template <size_t S, typename T> using type = point <S,T>; };
|
template <> struct result<vector,point> { template <std::size_t S, typename T> using type = point <S,T>; };
|
||||||
template <> struct result<vector,vector> { template <size_t S, typename T> using type = vector<S,T>; };
|
template <> struct result<vector,vector> { template <std::size_t S, typename T> using type = vector<S,T>; };
|
||||||
|
|
||||||
template <
|
template <
|
||||||
template <size_t,typename> class A,
|
template <std::size_t,typename> class A,
|
||||||
template <size_t,typename> class B
|
template <std::size_t,typename> class B
|
||||||
>
|
>
|
||||||
using result_t = typename result<A,B>::type;
|
using result_t = typename result<A,B>::type;
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
template <template <size_t,typename> class K>
|
template <template <std::size_t,typename> class K>
|
||||||
struct has_norm : public std::false_type { };
|
struct has_norm : public std::false_type { };
|
||||||
|
|
||||||
template <> struct has_norm<vector> : public std::true_type { };
|
template <> struct has_norm<vector> : public std::true_type { };
|
||||||
|
|
||||||
template <template <size_t,typename> class K>
|
template <template <std::size_t,typename> class K>
|
||||||
constexpr auto has_norm_v = has_norm<K>::value;
|
constexpr auto has_norm_v = has_norm<K>::value;
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
template <template <size_t,typename> class K>
|
template <template <std::size_t,typename> class K>
|
||||||
struct has_scalar_op : public std::false_type { };
|
struct has_scalar_op : public std::false_type { };
|
||||||
|
|
||||||
template <> struct has_scalar_op<colour> : public std::true_type { };
|
template <> struct has_scalar_op<colour> : public std::true_type { };
|
||||||
@ -75,16 +75,16 @@ namespace util {
|
|||||||
template <> struct has_scalar_op<point> : public std::true_type { };
|
template <> struct has_scalar_op<point> : public std::true_type { };
|
||||||
template <> struct has_scalar_op<vector> : public std::true_type { };
|
template <> struct has_scalar_op<vector> : public std::true_type { };
|
||||||
|
|
||||||
template <template <size_t,typename> class K>
|
template <template <std::size_t,typename> class K>
|
||||||
constexpr auto has_scalar_op_v = has_scalar_op<K>::value;
|
constexpr auto has_scalar_op_v = has_scalar_op<K>::value;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class> struct is_coord : std::false_type { };
|
template <class> struct is_coord : std::false_type { };
|
||||||
|
|
||||||
template <size_t S, typename T> struct is_coord<point<S,T>> : std::true_type { };
|
template <std::size_t S, typename T> struct is_coord<point<S,T>> : std::true_type { };
|
||||||
template <size_t S, typename T> struct is_coord<extent<S,T>> : std::true_type { };
|
template <std::size_t S, typename T> struct is_coord<extent<S,T>> : std::true_type { };
|
||||||
template <size_t S, typename T> struct is_coord<vector<S,T>> : std::true_type { };
|
template <std::size_t S, typename T> struct is_coord<vector<S,T>> : std::true_type { };
|
||||||
template <size_t S, typename T> struct is_coord<colour<S,T>> : std::true_type { };
|
template <std::size_t S, typename T> struct is_coord<colour<S,T>> : std::true_type { };
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
constexpr bool
|
constexpr bool
|
||||||
@ -115,11 +115,11 @@ namespace util {
|
|||||||
// vector operators
|
// vector operators
|
||||||
#define ELEMENT_OP(OP) \
|
#define ELEMENT_OP(OP) \
|
||||||
template < \
|
template < \
|
||||||
size_t S, \
|
std::size_t S, \
|
||||||
typename T, \
|
typename T, \
|
||||||
typename U, \
|
typename U, \
|
||||||
template <size_t,typename> class A, \
|
template <std::size_t,typename> class A, \
|
||||||
template <size_t,typename> class B, \
|
template <std::size_t,typename> class B, \
|
||||||
typename = std::enable_if_t< \
|
typename = std::enable_if_t< \
|
||||||
is_coord_v<A<S,T>> && is_coord_v<B<S,U>>, \
|
is_coord_v<A<S,T>> && is_coord_v<B<S,U>>, \
|
||||||
void \
|
void \
|
||||||
@ -132,17 +132,17 @@ namespace util {
|
|||||||
typename coord::result<A,B>::template type< \
|
typename coord::result<A,B>::template type< \
|
||||||
S,std::common_type_t<T,U> \
|
S,std::common_type_t<T,U> \
|
||||||
> out {}; \
|
> out {}; \
|
||||||
for (size_t i = 0; i < S; ++i) \
|
for (std::size_t i = 0; i < S; ++i) \
|
||||||
out[i] = a[i] OP b[i]; \
|
out[i] = a[i] OP b[i]; \
|
||||||
return out; \
|
return out; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
template < \
|
template < \
|
||||||
size_t S, \
|
std::size_t S, \
|
||||||
typename T, \
|
typename T, \
|
||||||
typename U, \
|
typename U, \
|
||||||
template <size_t,typename> class A, \
|
template <std::size_t,typename> class A, \
|
||||||
template <size_t,typename> class B, \
|
template <std::size_t,typename> class B, \
|
||||||
typename = std::enable_if_t< \
|
typename = std::enable_if_t< \
|
||||||
is_coord_v<A<S,T>> && \
|
is_coord_v<A<S,T>> && \
|
||||||
is_coord_v<B<S,U>> && \
|
is_coord_v<B<S,U>> && \
|
||||||
@ -155,7 +155,7 @@ namespace util {
|
|||||||
auto& \
|
auto& \
|
||||||
operator PASTE(OP,=) (A<S,T>& a, B<S,U> b) \
|
operator PASTE(OP,=) (A<S,T>& a, B<S,U> b) \
|
||||||
{ \
|
{ \
|
||||||
for (size_t i = 0; i < S; ++i) \
|
for (std::size_t i = 0; i < S; ++i) \
|
||||||
a[i] PASTE(OP,=) b[i]; \
|
a[i] PASTE(OP,=) b[i]; \
|
||||||
return a; \
|
return a; \
|
||||||
}
|
}
|
||||||
@ -171,10 +171,10 @@ namespace util {
|
|||||||
// scalar operators
|
// scalar operators
|
||||||
#define SCALAR_OP(OP) \
|
#define SCALAR_OP(OP) \
|
||||||
template < \
|
template < \
|
||||||
size_t S, \
|
std::size_t S, \
|
||||||
typename T, \
|
typename T, \
|
||||||
typename U, \
|
typename U, \
|
||||||
template <size_t,typename> class K, \
|
template <std::size_t,typename> class K, \
|
||||||
typename = std::enable_if_t< \
|
typename = std::enable_if_t< \
|
||||||
coord::has_scalar_op_v<K>, void \
|
coord::has_scalar_op_v<K>, void \
|
||||||
> \
|
> \
|
||||||
@ -185,16 +185,16 @@ namespace util {
|
|||||||
{ \
|
{ \
|
||||||
K<S,std::common_type_t<T,U>> out{}; \
|
K<S,std::common_type_t<T,U>> out{}; \
|
||||||
\
|
\
|
||||||
for (size_t i = 0; i < S; ++i) \
|
for (std::size_t i = 0; i < S; ++i) \
|
||||||
out[i] = u OP k[i]; \
|
out[i] = u OP k[i]; \
|
||||||
return out; \
|
return out; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
template < \
|
template < \
|
||||||
size_t S, \
|
std::size_t S, \
|
||||||
typename T, \
|
typename T, \
|
||||||
typename U, \
|
typename U, \
|
||||||
template <size_t,typename> class K, \
|
template <std::size_t,typename> class K, \
|
||||||
typename = std::enable_if_t< \
|
typename = std::enable_if_t< \
|
||||||
coord::has_scalar_op_v<K>,void \
|
coord::has_scalar_op_v<K>,void \
|
||||||
> \
|
> \
|
||||||
@ -205,7 +205,7 @@ namespace util {
|
|||||||
{ \
|
{ \
|
||||||
K<S,std::common_type_t<T,U>> out {}; \
|
K<S,std::common_type_t<T,U>> out {}; \
|
||||||
\
|
\
|
||||||
for (size_t i = 0; i < S; ++i) \
|
for (std::size_t i = 0; i < S; ++i) \
|
||||||
out[i] = k[i] OP u; \
|
out[i] = k[i] OP u; \
|
||||||
return out; \
|
return out; \
|
||||||
}
|
}
|
||||||
@ -226,10 +226,10 @@ namespace util {
|
|||||||
// destination type to avoid silent errors accumulating.
|
// destination type to avoid silent errors accumulating.
|
||||||
#define SCALAR_OP(OP) \
|
#define SCALAR_OP(OP) \
|
||||||
template < \
|
template < \
|
||||||
size_t S, \
|
std::size_t S, \
|
||||||
typename T, \
|
typename T, \
|
||||||
typename U, \
|
typename U, \
|
||||||
template <size_t,typename> class K, \
|
template <std::size_t,typename> class K, \
|
||||||
typename = std::enable_if_t< \
|
typename = std::enable_if_t< \
|
||||||
is_coord<K<S,T>>::value && \
|
is_coord<K<S,T>>::value && \
|
||||||
std::is_arithmetic<T>::value && \
|
std::is_arithmetic<T>::value && \
|
||||||
@ -246,7 +246,7 @@ namespace util {
|
|||||||
>& \
|
>& \
|
||||||
operator OP (K<S,T> &k, U u) \
|
operator OP (K<S,T> &k, U u) \
|
||||||
{ \
|
{ \
|
||||||
for (size_t i = 0; i < S; ++i) \
|
for (std::size_t i = 0; i < S; ++i) \
|
||||||
k[i] OP u; \
|
k[i] OP u; \
|
||||||
\
|
\
|
||||||
return k; \
|
return k; \
|
||||||
@ -265,9 +265,9 @@ namespace util {
|
|||||||
|
|
||||||
#define UNARY_OP(OP) \
|
#define UNARY_OP(OP) \
|
||||||
template < \
|
template < \
|
||||||
size_t S, \
|
std::size_t S, \
|
||||||
typename T, \
|
typename T, \
|
||||||
template <size_t,typename> class K, \
|
template <std::size_t,typename> class K, \
|
||||||
typename = std::enable_if_t< \
|
typename = std::enable_if_t< \
|
||||||
is_coord_v<K<S,T>>, void \
|
is_coord_v<K<S,T>>, void \
|
||||||
> \
|
> \
|
||||||
@ -278,7 +278,7 @@ namespace util {
|
|||||||
{ \
|
{ \
|
||||||
K<S,decltype(OP std::declval<T> ())> out{}; \
|
K<S,decltype(OP std::declval<T> ())> out{}; \
|
||||||
\
|
\
|
||||||
for (size_t i = 0; i < S; ++i) \
|
for (std::size_t i = 0; i < S; ++i) \
|
||||||
out[i] = OP k[i]; \
|
out[i] = OP k[i]; \
|
||||||
\
|
\
|
||||||
return out; \
|
return out; \
|
||||||
@ -354,9 +354,9 @@ namespace util {
|
|||||||
|
|
||||||
/// elementwise equality operator
|
/// elementwise equality operator
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -370,9 +370,9 @@ namespace util {
|
|||||||
///------------------------------------------------------------------------
|
///------------------------------------------------------------------------
|
||||||
/// elementwise inquality operator
|
/// elementwise inquality operator
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -386,9 +386,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -410,7 +410,7 @@ namespace util {
|
|||||||
|
|
||||||
/// point-point subtraction giving a vector difference
|
/// point-point subtraction giving a vector difference
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
typename U
|
typename U
|
||||||
>
|
>
|
||||||
@ -424,7 +424,7 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
typename U,
|
typename U,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
@ -442,7 +442,7 @@ namespace util {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T
|
typename T
|
||||||
>
|
>
|
||||||
constexpr
|
constexpr
|
||||||
@ -450,7 +450,7 @@ namespace util {
|
|||||||
dot (const T (&a)[S], const T (&b)[S])
|
dot (const T (&a)[S], const T (&b)[S])
|
||||||
{
|
{
|
||||||
T sum = 0;
|
T sum = 0;
|
||||||
for (size_t i = 0; i < S; ++i)
|
for (std::size_t i = 0; i < S; ++i)
|
||||||
sum += a[i] * b[i];
|
sum += a[i] * b[i];
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
@ -458,10 +458,10 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class A,
|
template <std::size_t,typename> class A,
|
||||||
template <size_t,typename> class B,
|
template <std::size_t,typename> class B,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<A<S,T>> && is_coord_v<B<S,T>>, void
|
is_coord_v<A<S,T>> && is_coord_v<B<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -476,9 +476,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -493,9 +493,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -510,9 +510,9 @@ namespace util {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<coord::has_norm_v<K>,void>
|
typename = std::enable_if_t<coord::has_norm_v<K>,void>
|
||||||
>
|
>
|
||||||
constexpr
|
constexpr
|
||||||
@ -525,9 +525,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
coord::has_norm_v<K>,
|
coord::has_norm_v<K>,
|
||||||
void
|
void
|
||||||
@ -543,9 +543,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
coord::has_norm_v<K>,
|
coord::has_norm_v<K>,
|
||||||
void
|
void
|
||||||
@ -564,9 +564,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
coord::has_norm_v<K>,
|
coord::has_norm_v<K>,
|
||||||
void
|
void
|
||||||
@ -582,9 +582,9 @@ namespace util {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -600,9 +600,9 @@ namespace util {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -619,9 +619,9 @@ namespace util {
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// root of sum of squares
|
// root of sum of squares
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -636,9 +636,9 @@ namespace util {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -659,9 +659,9 @@ namespace util {
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// trigonometric functions
|
// trigonometric functions
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<is_coord_v<K<S,T>>,void>
|
typename = std::enable_if_t<is_coord_v<K<S,T>>,void>
|
||||||
>
|
>
|
||||||
constexpr
|
constexpr
|
||||||
@ -681,9 +681,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<is_coord_v<K<S,T>>,void>
|
typename = std::enable_if_t<is_coord_v<K<S,T>>,void>
|
||||||
>
|
>
|
||||||
constexpr
|
constexpr
|
||||||
@ -706,9 +706,9 @@ namespace util {
|
|||||||
|
|
||||||
/// return a coord type containing the max element at each offset
|
/// return a coord type containing the max element at each offset
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>,
|
>,
|
||||||
@ -721,7 +721,7 @@ namespace util {
|
|||||||
static_assert ((... && std::is_same<K<S,T>, std::decay_t<Args>>::value));
|
static_assert ((... && std::is_same<K<S,T>, std::decay_t<Args>>::value));
|
||||||
|
|
||||||
K<S,T> out {};
|
K<S,T> out {};
|
||||||
for (size_t i = 0; i < S; ++i)
|
for (std::size_t i = 0; i < S; ++i)
|
||||||
out[i] = min (a[i], b[i], args[i]...);
|
out[i] = min (a[i], b[i], args[i]...);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -730,9 +730,9 @@ namespace util {
|
|||||||
///------------------------------------------------------------------------
|
///------------------------------------------------------------------------
|
||||||
// /return a coord type containing the max element at each offset
|
// /return a coord type containing the max element at each offset
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>,
|
>,
|
||||||
@ -745,7 +745,7 @@ namespace util {
|
|||||||
static_assert ((... && std::is_same<K<S,T>, std::decay_t<Args>>::value));
|
static_assert ((... && std::is_same<K<S,T>, std::decay_t<Args>>::value));
|
||||||
|
|
||||||
K<S,T> out {};
|
K<S,T> out {};
|
||||||
for (size_t i = 0; i < S; ++i)
|
for (std::size_t i = 0; i < S; ++i)
|
||||||
out[i] = max (a[i], b[i], args[i]...);
|
out[i] = max (a[i], b[i], args[i]...);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -759,9 +759,9 @@ namespace util {
|
|||||||
/// and hi because the min and max calls are ill definied for varying
|
/// and hi because the min and max calls are ill definied for varying
|
||||||
/// types (not because varying types would not be useful).
|
/// types (not because varying types would not be useful).
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template<size_t,typename> class K,
|
template<std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -777,9 +777,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -794,9 +794,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -811,9 +811,9 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -827,9 +827,9 @@ namespace util {
|
|||||||
|
|
||||||
///------------------------------------------------------------------------
|
///------------------------------------------------------------------------
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template<size_t,typename> class K,
|
template<std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -843,9 +843,9 @@ namespace util {
|
|||||||
|
|
||||||
|
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template<size_t,typename> class K,
|
template<std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -860,9 +860,9 @@ namespace util {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -888,11 +888,11 @@ namespace util {
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
#define VECTOR_OP(OP) \
|
#define VECTOR_OP(OP) \
|
||||||
template < \
|
template < \
|
||||||
size_t S, \
|
std::size_t S, \
|
||||||
typename T, \
|
typename T, \
|
||||||
typename U, \
|
typename U, \
|
||||||
template <size_t,typename> class A, \
|
template <std::size_t,typename> class A, \
|
||||||
template <size_t,typename> class B, \
|
template <std::size_t,typename> class B, \
|
||||||
typename = std::enable_if_t< \
|
typename = std::enable_if_t< \
|
||||||
is_coord_v<A<S,T>> && is_coord_v<B<S,U>>, void \
|
is_coord_v<A<S,T>> && is_coord_v<B<S,U>>, void \
|
||||||
> \
|
> \
|
||||||
@ -902,7 +902,7 @@ namespace util {
|
|||||||
operator OP (const A<S,T> a, const B<S,U> b) \
|
operator OP (const A<S,T> a, const B<S,U> b) \
|
||||||
{ \
|
{ \
|
||||||
vector<S,bool> out {}; \
|
vector<S,bool> out {}; \
|
||||||
for (size_t i = 0; i < S; ++i) \
|
for (std::size_t i = 0; i < S; ++i) \
|
||||||
out[i] = a[i] OP b[i]; \
|
out[i] = a[i] OP b[i]; \
|
||||||
return out; \
|
return out; \
|
||||||
}
|
}
|
||||||
@ -919,10 +919,10 @@ namespace util {
|
|||||||
|
|
||||||
#define SCALAR_OP(OP) \
|
#define SCALAR_OP(OP) \
|
||||||
template < \
|
template < \
|
||||||
size_t S, \
|
std::size_t S, \
|
||||||
typename T, \
|
typename T, \
|
||||||
typename U, \
|
typename U, \
|
||||||
template <size_t,typename> class K, \
|
template <std::size_t,typename> class K, \
|
||||||
typename = std::enable_if_t< \
|
typename = std::enable_if_t< \
|
||||||
is_coord_v<K<S,T>>, void \
|
is_coord_v<K<S,T>>, void \
|
||||||
> \
|
> \
|
||||||
@ -932,16 +932,16 @@ namespace util {
|
|||||||
operator OP (const K<S,T> k, const U u) \
|
operator OP (const K<S,T> k, const U u) \
|
||||||
{ \
|
{ \
|
||||||
vector<S,bool> out {}; \
|
vector<S,bool> out {}; \
|
||||||
for (size_t i = 0; i < S; ++i) \
|
for (std::size_t i = 0; i < S; ++i) \
|
||||||
out[i] = k[i] OP u; \
|
out[i] = k[i] OP u; \
|
||||||
return out; \
|
return out; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
template < \
|
template < \
|
||||||
size_t S, \
|
std::size_t S, \
|
||||||
typename T, \
|
typename T, \
|
||||||
typename U, \
|
typename U, \
|
||||||
template <size_t,typename> class K, \
|
template <std::size_t,typename> class K, \
|
||||||
typename = std::enable_if_t< \
|
typename = std::enable_if_t< \
|
||||||
is_coord_v<K<S,T>>, void \
|
is_coord_v<K<S,T>>, void \
|
||||||
> \
|
> \
|
||||||
@ -951,7 +951,7 @@ namespace util {
|
|||||||
operator OP (const U u, const K<S,T> k) \
|
operator OP (const U u, const K<S,T> k) \
|
||||||
{ \
|
{ \
|
||||||
vector<S,bool> out {}; \
|
vector<S,bool> out {}; \
|
||||||
for (size_t i = 0; i < S; ++i) \
|
for (std::size_t i = 0; i < S; ++i) \
|
||||||
out[i] = u OP k[i]; \
|
out[i] = u OP k[i]; \
|
||||||
return out; \
|
return out; \
|
||||||
}
|
}
|
||||||
@ -996,8 +996,8 @@ namespace util {
|
|||||||
/// we would ideally use range-for, but cbegin is not constexpr.
|
/// we would ideally use range-for, but cbegin is not constexpr.
|
||||||
/// so... moar templates.
|
/// so... moar templates.
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,bool>>, void
|
is_coord_v<K<S,bool>>, void
|
||||||
>,
|
>,
|
||||||
@ -1015,7 +1015,7 @@ namespace util {
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
template <
|
template <
|
||||||
std::size_t S,
|
std::size_t S,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
std::size_t ...I,
|
std::size_t ...I,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,bool>>,
|
is_coord_v<K<S,bool>>,
|
||||||
@ -1039,8 +1039,8 @@ namespace util {
|
|||||||
/// we would ideally use range-for, but cbegin is not constexpr.
|
/// we would ideally use range-for, but cbegin is not constexpr.
|
||||||
/// so... moar templates.
|
/// so... moar templates.
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,bool>>, void
|
is_coord_v<K<S,bool>>, void
|
||||||
>,
|
>,
|
||||||
@ -1060,9 +1060,9 @@ namespace util {
|
|||||||
///
|
///
|
||||||
/// corresponds to the function `select' from OpenCL.
|
/// corresponds to the function `select' from OpenCL.
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>,
|
is_coord_v<K<S,T>>,
|
||||||
void
|
void
|
||||||
@ -1073,7 +1073,7 @@ namespace util {
|
|||||||
select (vector<S,bool> s, K<S,T> a, K<S,T> b)
|
select (vector<S,bool> s, K<S,T> a, K<S,T> b)
|
||||||
{
|
{
|
||||||
K<S,T> k {};
|
K<S,T> k {};
|
||||||
for (size_t i = 0; i < S; ++i)
|
for (std::size_t i = 0; i < S; ++i)
|
||||||
k[i] = s[i] ? a[i] : b[i];
|
k[i] = s[i] ? a[i] : b[i];
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
@ -1081,9 +1081,9 @@ namespace util {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template<size_t,typename> class K,
|
template<std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>> && std::is_floating_point<T>::value, void
|
is_coord_v<K<S,T>> && std::is_floating_point<T>::value, void
|
||||||
>
|
>
|
||||||
@ -1112,7 +1112,7 @@ namespace util {
|
|||||||
template<
|
template<
|
||||||
std::size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -1136,7 +1136,7 @@ namespace util {
|
|||||||
template<
|
template<
|
||||||
std::size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <size_t,typename> class K,
|
template <std::size_t,typename> class K,
|
||||||
typename = std::enable_if_t<
|
typename = std::enable_if_t<
|
||||||
is_coord_v<K<S,T>>, void
|
is_coord_v<K<S,T>>, void
|
||||||
>
|
>
|
||||||
@ -1158,11 +1158,11 @@ namespace util {
|
|||||||
/// \tparam T underlying data type of the coordinate
|
/// \tparam T underlying data type of the coordinate
|
||||||
/// \tparam K coordinate data type to operate on
|
/// \tparam K coordinate data type to operate on
|
||||||
template <
|
template <
|
||||||
size_t I,
|
std::size_t I,
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template<
|
template<
|
||||||
size_t,
|
std::size_t,
|
||||||
typename
|
typename
|
||||||
> class K
|
> class K
|
||||||
>
|
>
|
||||||
@ -1186,11 +1186,11 @@ namespace util {
|
|||||||
/// \tparam T underlying data type of the coordinate
|
/// \tparam T underlying data type of the coordinate
|
||||||
/// \tparam K coordinate data type to operate on
|
/// \tparam K coordinate data type to operate on
|
||||||
template <
|
template <
|
||||||
size_t I,
|
std::size_t I,
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template<
|
template<
|
||||||
size_t,
|
std::size_t,
|
||||||
typename
|
typename
|
||||||
> class K
|
> class K
|
||||||
>
|
>
|
||||||
@ -1250,10 +1250,10 @@ namespace std {
|
|||||||
/// \tparam T data type
|
/// \tparam T data type
|
||||||
/// \tparam K coordinate class
|
/// \tparam K coordinate class
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template<
|
template<
|
||||||
size_t,
|
std::size_t,
|
||||||
typename
|
typename
|
||||||
> class K
|
> class K
|
||||||
>
|
>
|
||||||
@ -1272,11 +1272,11 @@ namespace std {
|
|||||||
/// \tparam T data type for the coordinate
|
/// \tparam T data type for the coordinate
|
||||||
/// \tparam K the underlying coordinate class
|
/// \tparam K the underlying coordinate class
|
||||||
template <
|
template <
|
||||||
size_t I,
|
std::size_t I,
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template<
|
template<
|
||||||
size_t,
|
std::size_t,
|
||||||
typename
|
typename
|
||||||
> class K
|
> class K
|
||||||
>
|
>
|
||||||
@ -1296,7 +1296,7 @@ namespace std {
|
|||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
template <
|
template <
|
||||||
std::size_t,typename
|
std::size_t,typename
|
||||||
@ -1309,7 +1309,7 @@ namespace std {
|
|||||||
> {
|
> {
|
||||||
std::size_t
|
std::size_t
|
||||||
operator() (K<S,T> k) const {
|
operator() (K<S,T> k) const {
|
||||||
size_t v = 0xdeadbeef;
|
std::size_t v = 0xdeadbeef;
|
||||||
|
|
||||||
for (auto t: k)
|
for (auto t: k)
|
||||||
v = ::util::hash::mix (t, v);
|
v = ::util::hash::mix (t, v);
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
*
|
||||||
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2015-2017 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __UTIL_COORD_STORE_HPP
|
#ifndef CRUFT_UTIL_COORD_STORE_HPP
|
||||||
#define __UTIL_COORD_STORE_HPP
|
#define CRUFT_UTIL_COORD_STORE_HPP
|
||||||
|
|
||||||
#include "names.hpp"
|
#include "names.hpp"
|
||||||
|
|
||||||
@ -31,8 +31,8 @@
|
|||||||
namespace util::coord::detail {
|
namespace util::coord::detail {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr
|
constexpr
|
||||||
size_t
|
std::size_t
|
||||||
alignment (size_t S)
|
alignment (std::size_t S)
|
||||||
{
|
{
|
||||||
(void)S;
|
(void)S;
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ namespace util::coord {
|
|||||||
// advantage of native platform SIMD. eg, 4f types are aligned to 16 bytes
|
// advantage of native platform SIMD. eg, 4f types are aligned to 16 bytes
|
||||||
// on SSE platforms.
|
// on SSE platforms.
|
||||||
template <
|
template <
|
||||||
size_t S,
|
std::size_t S,
|
||||||
typename T,
|
typename T,
|
||||||
typename...
|
typename...
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user