File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ using ::arolla::Unit;
5050using ::arolla::bitmap::AlmostFullBuilder;
5151using ::arolla::bitmap::Bitmap;
5252using ::arolla::bitmap::Word;
53+ using ::arolla::view_type_t ;
5354
5455// Filters and remaps bitmap by given array of ObjectId.
5556// The result is
@@ -122,13 +123,25 @@ class ValueBuffer : public absl::Span<T> {
122123 ValueBuffer (ValueBuffer&& other) : absl::Span<T>(other) {
123124 static_cast <absl::Span<T>&>(other) = absl::Span<T>(nullptr , 0 );
124125 }
126+
127+ explicit ValueBuffer (const arolla::Buffer<T>& buf) : ValueBuffer(buf.size()) {
128+ if constexpr (!std::is_same_v<view_type_t <T>, T>) {
129+ for (int64_t i = 0 ; i < buf.size (); ++i) {
130+ (*this )[i] = buf[i];
131+ }
132+ } else {
133+ std::copy (buf.begin (), buf.end (), this ->begin ());
134+ }
135+ }
136+
125137 ~ValueBuffer () { delete [] this ->data (); }
126138};
127139
128140template <>
129141class ValueBuffer <Unit> {
130142 public:
131143 explicit ValueBuffer (int64_t size) : size_(size) {}
144+ explicit ValueBuffer (const arolla::Buffer<Unit>& buf) : size_(buf.size()) {}
132145 int64_t size () const { return size_; }
133146 Unit operator [](int64_t offset) const { return Unit{}; }
134147 private:
You can’t perform that action at this time.
0 commit comments