Made non-const alias tensors convertible to const alias tensors.

This commit is contained in:
Davis King 2016-11-17 12:10:54 -05:00
parent b19e139dea
commit 30c629624e
2 changed files with 5 additions and 0 deletions

View File

@ -566,6 +566,8 @@ namespace dlib
const tensor& get() const { return inst; } const tensor& get() const { return inst; }
operator const tensor& () { return inst; } operator const tensor& () { return inst; }
alias_tensor_const_instance(const alias_tensor_instance& item) : inst(item) {}
private: private:
alias_tensor_instance inst; alias_tensor_instance inst;

View File

@ -601,6 +601,9 @@ namespace dlib
public: public:
// non-const alias tensors are convertible to const ones.
alias_tensor_const_instance(const alias_tensor_instance& item);
// Methods that cast the alias to a tensor. // Methods that cast the alias to a tensor.
const tensor& get() const; const tensor& get() const;
operator const tensor& (); operator const tensor& ();