Implementation of 1-Wire with added Alarm Search Functionality
Dependents: Max32630_One_Wire_Interface
Diff: array.hpp
- Revision:
- 49:36954b62f503
- Parent:
- 43:23017dcd2ec3
diff -r 6f9208ae280e -r 36954b62f503 array.hpp --- a/array.hpp Thu Apr 07 11:26:20 2016 -0500 +++ b/array.hpp Fri Apr 08 16:11:16 2016 -0500 @@ -4,11 +4,15 @@ #include <cstdint> #include <cstring> +/// Generic array class similar to std::array. template <typename T, std::size_t N> class array { public: + /// Number of elements contained in the array. static const std::size_t length = N; + + /// Built-in array representation. typedef T Buffer[N]; private: @@ -34,14 +38,16 @@ return !operator==(rhs); } + /// Conversion to array reference. operator Buffer &() { - return m_buffer; // Conversion to array reference + return m_buffer; } - operator const Buffer&() const + /// Conversion to const array reference. + operator const Buffer &() const { - return m_buffer; // Conversion to const array reference + return m_buffer; } array<T, N>() { } @@ -57,4 +63,4 @@ } }; -#endif \ No newline at end of file +#endif