From: Maksym Mamontov Date: Mon, 27 Jan 2020 21:02:05 +0000 (+0200) Subject: Replace STG::ARRAY with std::array. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/8337f36907f14b1e9979108800e82b8e0ca47a59 Replace STG::ARRAY with std::array. --- diff --git a/include/stg/array.h b/include/stg/array.h deleted file mode 100644 index 8550f167..00000000 --- a/include/stg/array.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __STG_ARRAY_H__ -#define __STG_ARRAY_H__ - -#include // size_t - -namespace STG -{ - -template -class ARRAY -{ - public: - typedef T value_type; - typedef size_t size_type; - typedef T * iterator; - typedef const T * const_iterator; - - ARRAY() - { - for (size_type i = 0; i < S; ++i) - m_data[i] = value_type(); - } - - const value_type & operator[](size_type i) const { return m_data[i]; } - value_type & operator[](size_type i) { return m_data[i]; } - size_type size() const { return S; } - - iterator begin() { return &m_data[0]; } - const_iterator begin() const { return &m_data[0]; } - iterator end() { return &m_data[S + 1]; } - const_iterator end() const { return &m_data[S + 1]; } - - const value_type & front() const { return m_data[0]; } - value_type & front() { return m_data[0]; } - const value_type & back() const { return m_data[S]; } - value_type & back() { return m_data[S]; } - - private: - value_type m_data[S]; -}; - -} // namespace STG - -#endif diff --git a/libs/srvconf/include/stg/servconf_types.h b/libs/srvconf/include/stg/servconf_types.h index 6c01d341..07f28fc5 100644 --- a/libs/srvconf/include/stg/servconf_types.h +++ b/libs/srvconf/include/stg/servconf_types.h @@ -21,11 +21,11 @@ #ifndef __STG_STGLIBS_SRVCONF_TYPES_H__ #define __STG_STGLIBS_SRVCONF_TYPES_H__ -#include "stg/array.h" #include "stg/const.h" // DIR_NUM #include #include +#include #include #include @@ -90,7 +90,7 @@ struct INFO int usersNum; std::string uname; int dirNum; - ARRAY dirName; + std::array dirName; }; typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data); @@ -108,10 +108,10 @@ namespace GET_USER struct STAT { - ARRAY su; - ARRAY sd; - ARRAY mu; - ARRAY md; + std::array su; + std::array sd; + std::array mu; + std::array md; }; struct INFO @@ -143,7 +143,7 @@ struct INFO STAT stat; time_t pingTime; time_t lastActivityTime; - ARRAY userData; + std::array userData; std::vector services; std::vector authBy; };