mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-14 14:59:52 -04:00
folly::Range -> std::span in string_table
This commit is contained in:
parent
5132082762
commit
3a09d21d05
@ -23,12 +23,11 @@
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <folly/Range.h>
|
||||
|
||||
#include "dwarfs/gen-cpp2/metadata_layouts.h"
|
||||
|
||||
namespace dwarfs {
|
||||
@ -66,24 +65,24 @@ class string_table {
|
||||
size_t unpacked_size() const { return impl_->unpacked_size(); }
|
||||
|
||||
static thrift::metadata::string_table
|
||||
pack(folly::Range<std::string const*> input,
|
||||
pack(std::span<std::string const> input,
|
||||
pack_options const& options = pack_options());
|
||||
|
||||
static thrift::metadata::string_table
|
||||
pack(folly::Range<std::string_view const*> input,
|
||||
pack(std::span<std::string_view const> input,
|
||||
pack_options const& options = pack_options());
|
||||
|
||||
static thrift::metadata::string_table
|
||||
pack(std::vector<std::string> const& input,
|
||||
pack_options const& options = pack_options()) {
|
||||
return pack(folly::Range(input.data(), input.size()), options);
|
||||
return pack(std::span(input.data(), input.size()), options);
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
static thrift::metadata::string_table
|
||||
pack(std::array<std::string_view, N> const& input,
|
||||
pack_options const& options = pack_options()) {
|
||||
return pack(folly::Range(input.data(), input.size()), options);
|
||||
return pack(std::span(input.data(), input.size()), options);
|
||||
}
|
||||
|
||||
class impl {
|
||||
@ -99,7 +98,7 @@ class string_table {
|
||||
private:
|
||||
template <typename T>
|
||||
static thrift::metadata::string_table
|
||||
pack_generic(folly::Range<T const*> input, pack_options const& options);
|
||||
pack_generic(std::span<T const> input, pack_options const& options);
|
||||
|
||||
std::unique_ptr<impl const> impl_;
|
||||
};
|
||||
|
@ -185,7 +185,7 @@ string_table::string_table(logger& lgr, std::string_view name,
|
||||
|
||||
template <typename T>
|
||||
thrift::metadata::string_table
|
||||
string_table::pack_generic(folly::Range<T const*> input,
|
||||
string_table::pack_generic(std::span<T const> input,
|
||||
pack_options const& options) {
|
||||
auto size = input.size();
|
||||
bool pack_data = options.pack_data;
|
||||
@ -296,13 +296,13 @@ string_table::pack_generic(folly::Range<T const*> input,
|
||||
}
|
||||
|
||||
thrift::metadata::string_table
|
||||
string_table::pack(folly::Range<std::string const*> input,
|
||||
string_table::pack(std::span<std::string const> input,
|
||||
pack_options const& options) {
|
||||
return pack_generic(input, options);
|
||||
}
|
||||
|
||||
thrift::metadata::string_table
|
||||
string_table::pack(folly::Range<std::string_view const*> input,
|
||||
string_table::pack(std::span<std::string_view const> input,
|
||||
pack_options const& options) {
|
||||
return pack_generic(input, options);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user