mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
keys: disable constructing from generic range
stdx::optional<T> uses quite elaborate std::enable_if_t magic to decide whether the argument passed to its constructor should be used for a call T constructor or stdx::optional<T> constructor. Apparently, with GCC 6.2 having T constructor which accepts any type confuses that magic and we end up with compile errors. The solution is to have from_range() method that replaces that constructor from range. There is also constructor that creates a key from std::vector<bytes> so that code generated by IDL works as it did before. Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com> Message-Id: <1474550971-15309-1-git-send-email-pdziepak@scylladb.com>
This commit is contained in:
committed by
Avi Kivity
parent
cfe7419f0f
commit
eb59b4c4ab
18
keys.hh
18
keys.hh
@@ -168,7 +168,7 @@ public:
|
||||
|
||||
template<typename RangeOfSerializedComponents>
|
||||
static TopLevel from_exploded(RangeOfSerializedComponents&& v) {
|
||||
return TopLevel(std::forward<RangeOfSerializedComponents>(v));
|
||||
return TopLevel::from_range(std::forward<RangeOfSerializedComponents>(v));
|
||||
}
|
||||
|
||||
static TopLevel from_exploded(const schema& s, const std::vector<bytes>& v) {
|
||||
@@ -615,8 +615,12 @@ public:
|
||||
using c_type = compound_type<allow_prefixes::no>;
|
||||
|
||||
template<typename RangeOfSerializedComponents>
|
||||
partition_key(RangeOfSerializedComponents&& v)
|
||||
: compound_wrapper(managed_bytes(c_type::serialize_value(std::forward<RangeOfSerializedComponents>(v))))
|
||||
static partition_key from_range(RangeOfSerializedComponents&& v) {
|
||||
return partition_key(managed_bytes(c_type::serialize_value(std::forward<RangeOfSerializedComponents>(v))));
|
||||
}
|
||||
|
||||
partition_key(std::vector<bytes> v)
|
||||
: compound_wrapper(managed_bytes(c_type::serialize_value(std::move(v))))
|
||||
{ }
|
||||
|
||||
partition_key(partition_key&& v) = default;
|
||||
@@ -705,8 +709,12 @@ class clustering_key_prefix : public prefix_compound_wrapper<clustering_key_pref
|
||||
{ }
|
||||
public:
|
||||
template<typename RangeOfSerializedComponents>
|
||||
clustering_key_prefix(RangeOfSerializedComponents&& v)
|
||||
: prefix_compound_wrapper(compound::element_type::serialize_value(std::forward<RangeOfSerializedComponents>(v)))
|
||||
static clustering_key_prefix from_range(RangeOfSerializedComponents&& v) {
|
||||
return clustering_key_prefix(compound::element_type::serialize_value(std::forward<RangeOfSerializedComponents>(v)));
|
||||
}
|
||||
|
||||
clustering_key_prefix(std::vector<bytes> v)
|
||||
: prefix_compound_wrapper(compound::element_type::serialize_value(std::move(v)))
|
||||
{ }
|
||||
|
||||
clustering_key_prefix(clustering_key_prefix&& v) = default;
|
||||
|
||||
@@ -1242,7 +1242,7 @@ void sstable::maybe_flush_pi_block(file_writer& out,
|
||||
// block size of new data.
|
||||
if (!clustering_key.empty()) {
|
||||
auto& rts = _pi_write.tombstone_accumulator->range_tombstones_for_row(
|
||||
clustering_key_prefix(clustering_key.values()));
|
||||
clustering_key_prefix::from_range(clustering_key.values()));
|
||||
for (const auto& rt : rts) {
|
||||
auto start = composite::from_clustering_element(*_pi_write.schemap, rt.start);
|
||||
auto end = composite::from_clustering_element(*_pi_write.schemap, rt.end);
|
||||
|
||||
Reference in New Issue
Block a user