Skip to content

Commit

Permalink
use memcpy
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Jul 10, 2023
1 parent ecf8c14 commit 473c934
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions benchmark/xml_benchmark.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "../rapidxml/rapidxml.hpp"
#include "xml_bench.hpp"
#include <cstdio>

class ScopedTimer {
public:
Expand Down
8 changes: 2 additions & 6 deletions frozen/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "frozen/bits/hash_string.h"
#include "frozen/bits/version.h"

#include <cstring>
#include <functional>

#ifdef FROZEN_LETITGO_HAS_STRING_VIEW
Expand Down Expand Up @@ -61,12 +62,7 @@ template <typename _CharT> class basic_string {
constexpr chr_t operator[](std::size_t i) const { return data_[i]; }

constexpr bool operator==(basic_string other) const {
if (size_ != other.size_)
return false;
for (std::size_t i = 0; i < size_; ++i)
if (data_[i] != other.data_[i])
return false;
return true;
return std::memcmp(data_, other.data_, size_) == 0;
}

constexpr bool operator<(const basic_string &other) const {
Expand Down

0 comments on commit 473c934

Please sign in to comment.