[XLA] Rework Array constructors a bit to allow creating a Array of unique_ptr<>
- Fill() does not work with type like unique_ptr<> which cannot be copied. - So have the basic constructor use default initialization. PiperOrigin-RevId: 358928330 Change-Id: I76915ee0deb9c7c64bd6b8efeb6e2399c65e42e1
This commit is contained in:
parent
97dfe8760a
commit
9c9af7b05a
@ -96,8 +96,9 @@ class Array {
|
||||
|
||||
using value_type = T;
|
||||
|
||||
// Creates a new array with the specified dimensions.
|
||||
explicit Array(absl::Span<const int64> sizes) : Array(sizes, T()) {}
|
||||
// Creates a new array with the specified dimensions and initialized elements.
|
||||
explicit Array(absl::Span<const int64> sizes)
|
||||
: sizes_(sizes.begin(), sizes.end()), values_(new T[num_elements()]()) {}
|
||||
|
||||
// Creates a new array with the specified dimensions and specified value for
|
||||
// every cell.
|
||||
|
Loading…
Reference in New Issue
Block a user