iterators with begin(), end(). vector / matrix bipolar
parent
ffeab29e5f
commit
dafbe6ea8b
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
include(cmake/color.cmake)
|
||||
set(BLT_VERSION 2.0.9)
|
||||
set(BLT_VERSION 2.1.0)
|
||||
|
||||
set(BLT_TARGET BLT)
|
||||
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
namespace blt
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
static inline auto iterate(T begin, T end)
|
||||
{
|
||||
return iterator::iterator_container<T>{std::move(begin), std::move(end)};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline auto iterate(T& container)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <type_traits>
|
||||
#include <array>
|
||||
#include <initializer_list>
|
||||
#include "blt/iterator/iterator.h"
|
||||
|
||||
#ifndef M_PI
|
||||
// MSVC does not have M_PI
|
||||
|
@ -163,6 +164,17 @@ namespace blt
|
|||
return copy;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr matrix_t bipolar() const
|
||||
{
|
||||
matrix_t copy = *this;
|
||||
for (auto& v : copy.data)
|
||||
{
|
||||
for (auto& d : blt::iterate(v.begin(), v.end()))
|
||||
d = d >= 0 ? 1 : -1;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
constexpr inline const blt::vec<T, rows>& operator[](u32 column) const
|
||||
{
|
||||
return data[column];
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace blt
|
|||
private:
|
||||
std::array<T, size> elements;
|
||||
public:
|
||||
constexpr static blt::u32 data_size = size;
|
||||
|
||||
constexpr vec()
|
||||
{
|
||||
for (auto& v : elements)
|
||||
|
|
Loading…
Reference in New Issue