- Quaternions
- Started Tests for Quaternions - Fixed some style issues with constructors
This commit is contained in:
@@ -55,7 +55,7 @@ public:
|
||||
///
|
||||
/// \brief Default Constructor, initializes empty string
|
||||
constexpr _string()
|
||||
: _str() {
|
||||
: _str() {
|
||||
}
|
||||
|
||||
///
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
///
|
||||
/// \details adds additional character for null termination.
|
||||
constexpr _string(size_t n)
|
||||
: _string('\0', n) {
|
||||
: _string('\0', n) {
|
||||
}
|
||||
|
||||
///
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
///
|
||||
/// \details adds additional character for null termination.
|
||||
constexpr _string(char c, size_t n)
|
||||
: _str(n + 1) {
|
||||
: _str(n + 1) {
|
||||
fennec::memset(_str.data(), c, n); _str[n] = '\0';
|
||||
}
|
||||
///
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
/// This constructor makes the assumption that `len` is the intended number of characters.
|
||||
template<size_t n>
|
||||
constexpr _string(const char str[n])
|
||||
: _str(str, n + 1) {
|
||||
: _str(str, n + 1) {
|
||||
::strncpy(_str.data(), str, n);
|
||||
_str[n] = '\0';
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
/// \details adds additional character for null termination. Ignores whether str is null-terminated.
|
||||
/// This constructor makes the assumption that `len` is the intended number of characters.
|
||||
constexpr _string(const char* str, size_t n)
|
||||
: _str(str, n + 1) {
|
||||
: _str(str, n + 1) {
|
||||
::strncpy(_str.data(), str, n);
|
||||
_str[n] = '\0';
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
/// \details adds additional character for null termination. Ignores whether str is null-terminated.
|
||||
/// This constructor makes the assumption that `len` is the intended number of characters.
|
||||
constexpr _string(const cstring& str)
|
||||
: _str(str, str.size() + 1) {
|
||||
: _str(str, str.size() + 1) {
|
||||
_str[str.size()] = '\0';
|
||||
}
|
||||
|
||||
@@ -120,11 +120,12 @@ public:
|
||||
/// \brief String Copy Constructor
|
||||
/// \param str the string to copy
|
||||
constexpr _string(const string& str)
|
||||
: _string(str, str.size()) {
|
||||
: _string(str, str.size()) {
|
||||
}
|
||||
|
||||
constexpr _string(_string&& str) noexcept
|
||||
: _str(fennec::move(str._str)) { }
|
||||
: _str(fennec::move(str._str)) {
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief String Destructor, cleans up the underlying allocation
|
||||
|
||||
Reference in New Issue
Block a user