Files
Daniel Lemire 95d8c81810 When using C++11, we could violate the one definition rule (#2606)
* When using C++11, we could violate the one definition rule

* fix

* simplifying

* disabling new 'test' when using shared libs
2026-02-18 20:08:53 -05:00

14 lines
475 B
C++

#include "mylib.h"
#include <simdjson.h>
#include <memory>
simdjson::padded_string minify_json(const simdjson::padded_string& json) {
size_t length = json.size();
std::unique_ptr<char[]> buffer{new char[length]};
size_t new_length{};
auto error = simdjson::minify(json.data(), length, buffer.get(), new_length);
if (error) {
return simdjson::padded_string();
}
return simdjson::padded_string(std::string_view(buffer.get(), new_length));
}