Skip to content

Commit 4b81bf2

Browse files
committed
Update single header
1 parent c663ae1 commit 4b81bf2

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

single_include/tabulate/tabulate.hpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6147,6 +6147,7 @@ inline size_t get_sequence_length(const std::string &text, const std::string &lo
61476147
return text.length();
61486148

61496149
#if defined(_WIN32) || defined(_WIN64)
6150+
(void) locale; // unused parameter
61506151
return (text.length() - std::count_if(text.begin(), text.end(),
61516152
[](char c) -> bool { return (c & 0xC0) == 0x80; }));
61526153
#elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
@@ -7531,7 +7532,15 @@ SOFTWARE.
75317532
#include <functional>
75327533
#include <iostream>
75337534
#include <memory>
7535+
7536+
#if __cplusplus >= 201703L
75347537
#include <optional>
7538+
using std::optional;
7539+
#else
7540+
// #include <tabulate/optional_lite.hpp>
7541+
using nonstd::optional;
7542+
#endif
7543+
75357544
#include <string>
75367545
// #include <tabulate/cell.hpp>
75377546
// #include <tabulate/column_format.hpp>
@@ -8610,17 +8619,17 @@ SOFTWARE.
86108619
#include <variant>
86118620
using std::get_if;
86128621
using std::holds_alternative;
8622+
using std::string_view;
86138623
using std::variant;
86148624
using std::visit;
8615-
using std::string_view;
86168625
#else
86178626
// #include <tabulate/string_view_lite.hpp>
86188627
// #include <tabulate/variant_lite.hpp>
86198628
using nonstd::get_if;
86208629
using nonstd::holds_alternative;
8630+
using nonstd::string_view;
86218631
using nonstd::variant;
86228632
using nonstd::visit;
8623-
using nonstd::string_view;
86248633
#endif
86258634

86268635
#include <utility>
@@ -8631,7 +8640,8 @@ class Table {
86318640
public:
86328641
Table() : table_(TableInternal::create()) {}
86338642

8634-
using Row_t = std::vector<variant<std::string, const char *, string_view, Table>>;
8643+
using Row_t =
8644+
std::vector<variant<std::string, const char *, string_view, Table>>;
86358645

86368646
Table &add_row(const Row_t &cells) {
86378647

@@ -8656,7 +8666,7 @@ class Table {
86568666
cell_strings[i] = *get_if<std::string>(&cell);
86578667
} else if (holds_alternative<const char *>(cell)) {
86588668
cell_strings[i] = *get_if<const char *>(&cell);
8659-
} else if (holds_alternative<string_view>(cell)) {
8669+
} else if (holds_alternative<string_view>(cell)) {
86608670
cell_strings[i] = std::string{*get_if<string_view>(&cell)};
86618671
} else {
86628672
auto table = *get_if<Table>(&cell);
@@ -8687,11 +8697,14 @@ class Table {
86878697
return stream.str();
86888698
}
86898699

8700+
size_t size() const { return table_->size(); }
8701+
86908702
std::pair<size_t, size_t> shape() { return table_->shape(); }
86918703

86928704
class RowIterator {
86938705
public:
8694-
explicit RowIterator(std::vector<std::shared_ptr<Row>>::iterator ptr) : ptr(ptr) {}
8706+
explicit RowIterator(std::vector<std::shared_ptr<Row>>::iterator ptr)
8707+
: ptr(ptr) {}
86958708

86968709
RowIterator operator++() {
86978710
++ptr;

0 commit comments

Comments
 (0)