Skip to content

Commit

Permalink
to address
Browse files Browse the repository at this point in the history
  • Loading branch information
liss-h committed Feb 21, 2025
1 parent 9f0eb53 commit af36fcf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions include/dice/template-library/static_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace dice::template_library {
: size_{sv.size()}, alloc_{alloc} {

data_ = std::allocator_traits<allocator_type>::allocate(alloc_, size_);
memcpy(data_, sv.data(), size_);
memcpy(std::to_address(data_), sv.data(), size_);
}

basic_static_string(basic_static_string const &) = delete;
Expand Down Expand Up @@ -82,7 +82,7 @@ namespace dice::template_library {
data_ = std::allocator_traits<allocator_type>::allocate(alloc_, size_);
}

memcpy(data_, other.data_, size_);
memcpy(std::to_address(data_), other.data_, size_);
return *this;
}
}
Expand All @@ -94,10 +94,13 @@ namespace dice::template_library {
}

operator view_type() const noexcept {
return {data_, size_};
return {std::to_address(data_), size_};
}

[[nodiscard]] value_type const *data() const noexcept {
[[nodiscard]] const_pointer data() const noexcept {
return data_;
}
[[nodiscard]] pointer data() noexcept {
return data_;
}

Expand Down

0 comments on commit af36fcf

Please sign in to comment.