Skip to content

Commit

Permalink
Updated style
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed May 19, 2024
1 parent 44ede65 commit 139cad4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions include/halfvec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ class HalfVector {
public:
HalfVector() = default;

HalfVector(const std::vector<float> &value) {
HalfVector(const std::vector<float>& value) {
value_ = value;
}

HalfVector(std::vector<float>&& value) {
value_ = std::move(value);
}

HalfVector(const float *value, size_t n) {
HalfVector(const float* value, size_t n) {
value_ = std::vector<float>{value, value + n};
}

Expand All @@ -34,11 +34,11 @@ class HalfVector {
return value_;
}

friend bool operator==(const HalfVector &lhs, const HalfVector &rhs) {
friend bool operator==(const HalfVector& lhs, const HalfVector& rhs) {
return lhs.value_ == rhs.value_;
}

friend std::ostream &operator<<(std::ostream &os, const HalfVector &value) {
friend std::ostream& operator<<(std::ostream& os, const HalfVector& value) {
os << "[";
for (size_t i = 0; i < value.value_.size(); i++) {
if (i > 0) {
Expand Down
12 changes: 6 additions & 6 deletions include/pqxx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ template <> struct string_traits<pgvector::Vector> {
return pgvector::Vector(result);
}

static zview to_buf(char *begin, char *end, pgvector::Vector const &value) {
static zview to_buf(char* begin, char* end, pgvector::Vector const& value) {
char *const next = into_buf(begin, end, value);
return zview{begin, next - begin - 1};
}

static char *into_buf(char *begin, char *end, pgvector::Vector const &value) {
static char* into_buf(char* begin, char* end, pgvector::Vector const& value) {
auto ret = string_traits<std::vector<float>>::into_buf(
begin, end, static_cast<std::vector<float>>(value));
// replace array brackets
Expand All @@ -51,7 +51,7 @@ template <> struct string_traits<pgvector::Vector> {
return ret;
}

static size_t size_buffer(pgvector::Vector const &value) noexcept {
static size_t size_buffer(pgvector::Vector const& value) noexcept {
return string_traits<std::vector<float>>::size_buffer(
static_cast<std::vector<float>>(value));
}
Expand Down Expand Up @@ -82,12 +82,12 @@ template <> struct string_traits<pgvector::HalfVector> {
return pgvector::HalfVector(result);
}

static zview to_buf(char *begin, char *end, pgvector::HalfVector const &value) {
static zview to_buf(char* begin, char* end, pgvector::HalfVector const& value) {
char *const next = into_buf(begin, end, value);
return zview{begin, next - begin - 1};
}

static char *into_buf(char *begin, char *end, pgvector::HalfVector const &value) {
static char *into_buf(char *begin, char *end, pgvector::HalfVector const& value) {
auto ret = string_traits<std::vector<float>>::into_buf(
begin, end, static_cast<std::vector<float>>(value));
// replace array brackets
Expand All @@ -96,7 +96,7 @@ template <> struct string_traits<pgvector::HalfVector> {
return ret;
}

static size_t size_buffer(pgvector::HalfVector const &value) noexcept {
static size_t size_buffer(pgvector::HalfVector const& value) noexcept {
return string_traits<std::vector<float>>::size_buffer(
static_cast<std::vector<float>>(value));
}
Expand Down
8 changes: 4 additions & 4 deletions include/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ class Vector {
public:
Vector() = default;

Vector(const std::vector<float> &value) {
Vector(const std::vector<float>& value) {
value_ = value;
}

Vector(std::vector<float>&& value) {
value_ = std::move(value);
}

Vector(const float *value, size_t n) {
Vector(const float* value, size_t n) {
value_ = std::vector<float>{value, value + n};
}

Expand All @@ -34,11 +34,11 @@ class Vector {
return value_;
}

friend bool operator==(const Vector &lhs, const Vector &rhs) {
friend bool operator==(const Vector& lhs, const Vector& rhs) {
return lhs.value_ == rhs.value_;
}

friend std::ostream &operator<<(std::ostream &os, const Vector &value) {
friend std::ostream& operator<<(std::ostream& os, const Vector& value) {
os << "[";
for (size_t i = 0; i < value.value_.size(); i++) {
if (i > 0) {
Expand Down

0 comments on commit 139cad4

Please sign in to comment.