mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-16 14:08:59 +07:00
remove std::array and std::bitset aliases
This commit is contained in:
@@ -32,13 +32,6 @@ namespace e2d
|
|||||||
class exception
|
class exception
|
||||||
: public std::exception {};
|
: public std::exception {};
|
||||||
|
|
||||||
template < typename Value
|
|
||||||
, std::size_t Size >
|
|
||||||
using array = std::array<Value, Size>;
|
|
||||||
|
|
||||||
template < std::size_t Size >
|
|
||||||
using bitset = std::bitset<Size>;
|
|
||||||
|
|
||||||
template < typename Value
|
template < typename Value
|
||||||
, typename Allocator = std::allocator<Value> >
|
, typename Allocator = std::allocator<Value> >
|
||||||
using vector = std::vector<Value, Allocator>;
|
using vector = std::vector<Value, Allocator>;
|
||||||
@@ -81,12 +74,12 @@ namespace e2d
|
|||||||
{
|
{
|
||||||
template < typename Key
|
template < typename Key
|
||||||
, typename Compare = std::less<>
|
, typename Compare = std::less<>
|
||||||
, typename Container = std::vector<Key> >
|
, typename Container = vector<Key> >
|
||||||
using flat_set = flat_hpp::flat_set<Key, Compare, Container>;
|
using flat_set = flat_hpp::flat_set<Key, Compare, Container>;
|
||||||
|
|
||||||
template < typename Key
|
template < typename Key
|
||||||
, typename Value
|
, typename Value
|
||||||
, typename Compare = std::less<>
|
, typename Compare = std::less<>
|
||||||
, typename Container = std::vector<std::pair<Key, Value>> >
|
, typename Container = vector<std::pair<Key, Value>> >
|
||||||
using flat_map = flat_hpp::flat_map<Key, Value, Compare, Container>;
|
using flat_map = flat_hpp::flat_map<Key, Value, Compare, Container>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ namespace e2d
|
|||||||
std::size_t bytes_per_vertex() const noexcept;
|
std::size_t bytes_per_vertex() const noexcept;
|
||||||
private:
|
private:
|
||||||
constexpr static std::size_t max_attribute_count = 8;
|
constexpr static std::size_t max_attribute_count = 8;
|
||||||
array<attribute_info, max_attribute_count> attributes_;
|
std::array<attribute_info, max_attribute_count> attributes_;
|
||||||
std::size_t attribute_count_ = 0;
|
std::size_t attribute_count_ = 0;
|
||||||
std::size_t bytes_per_vertex_ = 0;
|
std::size_t bytes_per_vertex_ = 0;
|
||||||
};
|
};
|
||||||
@@ -728,7 +728,7 @@ namespace e2d
|
|||||||
const property_block& properties() const noexcept;
|
const property_block& properties() const noexcept;
|
||||||
private:
|
private:
|
||||||
constexpr static std::size_t max_pass_count = 8;
|
constexpr static std::size_t max_pass_count = 8;
|
||||||
array<pass_state, max_pass_count> passes_;
|
std::array<pass_state, max_pass_count> passes_;
|
||||||
std::size_t pass_count_ = 0;
|
std::size_t pass_count_ = 0;
|
||||||
property_block properties_;
|
property_block properties_;
|
||||||
};
|
};
|
||||||
@@ -755,7 +755,7 @@ namespace e2d
|
|||||||
private:
|
private:
|
||||||
constexpr static std::size_t max_vertices_count = 8;
|
constexpr static std::size_t max_vertices_count = 8;
|
||||||
index_buffer_ptr indices_;
|
index_buffer_ptr indices_;
|
||||||
array<vertex_buffer_ptr, max_vertices_count> vertices_;
|
std::array<vertex_buffer_ptr, max_vertices_count> vertices_;
|
||||||
std::size_t vertices_count_ = 0;
|
std::size_t vertices_count_ = 0;
|
||||||
topology topology_ = topology::triangles;
|
topology topology_ = topology::triangles;
|
||||||
};
|
};
|
||||||
@@ -880,7 +880,7 @@ namespace e2d
|
|||||||
const command_value& command(std::size_t index) const noexcept;
|
const command_value& command(std::size_t index) const noexcept;
|
||||||
std::size_t command_count() const noexcept;
|
std::size_t command_count() const noexcept;
|
||||||
private:
|
private:
|
||||||
array<command_value, N> commands_;
|
std::array<command_value, N> commands_;
|
||||||
std::size_t command_count_ = 0;
|
std::size_t command_count_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace e2d
|
|||||||
, size_(buffer.size() * sizeof(T)) {}
|
, size_(buffer.size() * sizeof(T)) {}
|
||||||
|
|
||||||
template < typename T, std::size_t N >
|
template < typename T, std::size_t N >
|
||||||
buffer_view(const array<T,N>& buffer) noexcept
|
buffer_view(const std::array<T,N>& buffer) noexcept
|
||||||
: data_(buffer.data())
|
: data_(buffer.data())
|
||||||
, size_(buffer.size() * sizeof(T)) {}
|
, size_(buffer.size() * sizeof(T)) {}
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ namespace e2d
|
|||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
v2f cursor_pos;
|
v2f cursor_pos;
|
||||||
v2f scroll_delta;
|
v2f scroll_delta;
|
||||||
bitset<
|
std::bitset<
|
||||||
utils::enum_to_underlying(mouse_button::unknown) + 1> pressed;
|
utils::enum_to_underlying(mouse_button::unknown) + 1> pressed;
|
||||||
bitset<
|
std::bitset<
|
||||||
utils::enum_to_underlying(mouse_button::unknown) + 1> just_pressed;
|
utils::enum_to_underlying(mouse_button::unknown) + 1> just_pressed;
|
||||||
bitset<
|
std::bitset<
|
||||||
utils::enum_to_underlying(mouse_button::unknown) + 1> just_released;
|
utils::enum_to_underlying(mouse_button::unknown) + 1> just_released;
|
||||||
public:
|
public:
|
||||||
std::size_t button_index(mouse_button btn) const noexcept {
|
std::size_t button_index(mouse_button btn) const noexcept {
|
||||||
@@ -80,11 +80,11 @@ namespace e2d
|
|||||||
public:
|
public:
|
||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
str32 input_text;
|
str32 input_text;
|
||||||
bitset<
|
std::bitset<
|
||||||
utils::enum_to_underlying(keyboard_key::unknown) + 1> pressed;
|
utils::enum_to_underlying(keyboard_key::unknown) + 1> pressed;
|
||||||
bitset<
|
std::bitset<
|
||||||
utils::enum_to_underlying(keyboard_key::unknown) + 1> just_pressed;
|
utils::enum_to_underlying(keyboard_key::unknown) + 1> just_pressed;
|
||||||
bitset<
|
std::bitset<
|
||||||
utils::enum_to_underlying(keyboard_key::unknown) + 1> just_released;
|
utils::enum_to_underlying(keyboard_key::unknown) + 1> just_released;
|
||||||
public:
|
public:
|
||||||
std::size_t key_index(keyboard_key key) const noexcept {
|
std::size_t key_index(keyboard_key key) const noexcept {
|
||||||
@@ -260,7 +260,7 @@ namespace e2d
|
|||||||
return state_->just_released.test(index);
|
return state_->just_released.test(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyboard::extract_pressed_keys(std::vector<keyboard_key>& dst) const {
|
void keyboard::extract_pressed_keys(vector<keyboard_key>& dst) const {
|
||||||
std::lock_guard<std::mutex> guard(state_->mutex);
|
std::lock_guard<std::mutex> guard(state_->mutex);
|
||||||
for ( std::size_t i = 0; i < state_->pressed.size(); ++i ) {
|
for ( std::size_t i = 0; i < state_->pressed.size(); ++i ) {
|
||||||
if ( state_->pressed.test(i) ) {
|
if ( state_->pressed.test(i) ) {
|
||||||
@@ -269,7 +269,7 @@ namespace e2d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyboard::extract_just_pressed_keys(std::vector<keyboard_key>& dst) const {
|
void keyboard::extract_just_pressed_keys(vector<keyboard_key>& dst) const {
|
||||||
std::lock_guard<std::mutex> guard(state_->mutex);
|
std::lock_guard<std::mutex> guard(state_->mutex);
|
||||||
for ( std::size_t i = 0; i < state_->just_pressed.size(); ++i ) {
|
for ( std::size_t i = 0; i < state_->just_pressed.size(); ++i ) {
|
||||||
if ( state_->just_pressed.test(i) ) {
|
if ( state_->just_pressed.test(i) ) {
|
||||||
@@ -278,7 +278,7 @@ namespace e2d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyboard::extract_just_released_keys(std::vector<keyboard_key>& dst) const {
|
void keyboard::extract_just_released_keys(vector<keyboard_key>& dst) const {
|
||||||
std::lock_guard<std::mutex> guard(state_->mutex);
|
std::lock_guard<std::mutex> guard(state_->mutex);
|
||||||
for ( std::size_t i = 0; i < state_->just_released.size(); ++i ) {
|
for ( std::size_t i = 0; i < state_->just_released.size(); ++i ) {
|
||||||
if ( state_->just_released.test(i) ) {
|
if ( state_->just_released.test(i) ) {
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ namespace e2d
|
|||||||
public:
|
public:
|
||||||
using window_uptr = std::unique_ptr<
|
using window_uptr = std::unique_ptr<
|
||||||
GLFWwindow, void(*)(GLFWwindow*)>;
|
GLFWwindow, void(*)(GLFWwindow*)>;
|
||||||
using listeners_t = std::vector<event_listener_uptr>;
|
using listeners_t = vector<event_listener_uptr>;
|
||||||
public:
|
public:
|
||||||
listeners_t listeners;
|
listeners_t listeners;
|
||||||
std::recursive_mutex rmutex;
|
std::recursive_mutex rmutex;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace e2d
|
|||||||
{
|
{
|
||||||
class window::state final : private e2d::noncopyable {
|
class window::state final : private e2d::noncopyable {
|
||||||
public:
|
public:
|
||||||
using listeners_t = std::vector<event_listener_uptr>;
|
using listeners_t = vector<event_listener_uptr>;
|
||||||
public:
|
public:
|
||||||
listeners_t listeners;
|
listeners_t listeners;
|
||||||
std::recursive_mutex rmutex;
|
std::recursive_mutex rmutex;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace
|
|||||||
const str_view mesh_file_signature = "e2d_mesh";
|
const str_view mesh_file_signature = "e2d_mesh";
|
||||||
|
|
||||||
template < typename T >
|
template < typename T >
|
||||||
input_sequence& iseq_read_vector_pods(input_sequence& iseq, std::vector<T>& v) {
|
input_sequence& iseq_read_vector_pods(input_sequence& iseq, vector<T>& v) {
|
||||||
return iseq.read(v.data(), v.size() * sizeof(T));
|
return iseq.read(v.data(), v.size() * sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace
|
|||||||
const str_view shape_file_signature = "e2d_shape";
|
const str_view shape_file_signature = "e2d_shape";
|
||||||
|
|
||||||
template < typename T >
|
template < typename T >
|
||||||
input_sequence& iseq_read_vector_pods(input_sequence& iseq, std::vector<T>& v) {
|
input_sequence& iseq_read_vector_pods(input_sequence& iseq, vector<T>& v) {
|
||||||
return iseq.read(v.data(), v.size() * sizeof(T));
|
return iseq.read(v.data(), v.size() * sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ TEST_CASE("input"){
|
|||||||
input i;
|
input i;
|
||||||
const mouse& m = i.mouse();
|
const mouse& m = i.mouse();
|
||||||
|
|
||||||
std::vector<mouse_button> buttons;
|
vector<mouse_button> buttons;
|
||||||
m.extract_pressed_buttons(buttons);
|
m.extract_pressed_buttons(buttons);
|
||||||
m.extract_just_pressed_buttons(buttons);
|
m.extract_just_pressed_buttons(buttons);
|
||||||
m.extract_just_released_buttons(buttons);
|
m.extract_just_released_buttons(buttons);
|
||||||
@@ -208,7 +208,7 @@ TEST_CASE("input"){
|
|||||||
input i;
|
input i;
|
||||||
const keyboard& k = i.keyboard();
|
const keyboard& k = i.keyboard();
|
||||||
|
|
||||||
std::vector<keyboard_key> keys;
|
vector<keyboard_key> keys;
|
||||||
k.extract_pressed_keys(keys);
|
k.extract_pressed_keys(keys);
|
||||||
k.extract_just_pressed_keys(keys);
|
k.extract_just_pressed_keys(keys);
|
||||||
k.extract_just_released_keys(keys);
|
k.extract_just_released_keys(keys);
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ TEST_CASE("buffer_view") {
|
|||||||
REQUIRE(v4.data() == b1.data());
|
REQUIRE(v4.data() == b1.data());
|
||||||
REQUIRE(v4.size() == 10);
|
REQUIRE(v4.size() == 10);
|
||||||
|
|
||||||
array<u32,5> b2{'h', 'e', 'l', 'l', 'o'};
|
std::array<u32,5> b2{'h', 'e', 'l', 'l', 'o'};
|
||||||
buffer_view v5(b2);
|
buffer_view v5(b2);
|
||||||
REQUIRE(v5.data() == b2.data());
|
REQUIRE(v5.data() == b2.data());
|
||||||
REQUIRE(v5.size() == 20);
|
REQUIRE(v5.size() == 20);
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ TEST_CASE("intrusive_ptr") {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto p1 = make_intrusive<obj_t>(10);
|
auto p1 = make_intrusive<obj_t>(10);
|
||||||
std::unordered_set<intrusive_ptr<obj_t>> s;
|
hash_set<intrusive_ptr<obj_t>> s;
|
||||||
s.insert(p1);
|
s.insert(p1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user