diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 10:25:54 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 10:25:54 +0800 |
commit | 094828d59df3931dfced69c59cbb538d6b0f1d99 (patch) | |
tree | 753c6138eb05ef16e9a613e8b95dbb169e17fca3 | |
parent | cccccbf6cca94a3eaf813b4468453160e91c332b (diff) | |
download | tnet-094828d59df3931dfced69c59cbb538d6b0f1d99.tar.gz tnet-094828d59df3931dfced69c59cbb538d6b0f1d99.tar.bz2 tnet-094828d59df3931dfced69c59cbb538d6b0f1d99.zip |
make const compatible
-rw-r--r-- | src/CuBaseLib/cumatrix.h | 4 | ||||
-rw-r--r-- | src/CuBaseLib/cumatrix.tcc | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/CuBaseLib/cumatrix.h b/src/CuBaseLib/cumatrix.h index 887b92d..dd76bb2 100644 --- a/src/CuBaseLib/cumatrix.h +++ b/src/CuBaseLib/cumatrix.h @@ -76,9 +76,9 @@ namespace TNet { /// Allocate the memory ThisType& Init(size_t rows, size_t cols); /// Copy the ptr of rSrc starting at x with span of cols - ThisType& Init(CuMatrix<_ElemT>& rSrc, size_t x, size_t cols); + ThisType& Init(const CuMatrix<_ElemT>& rSrc, size_t x, size_t cols); /// Copy the settings of rSrc - ThisType& Init(CuMatrix<_ElemT>& rSrc); + ThisType& Init(const CuMatrix<_ElemT>& rSrc); /// Deallocate the memory void Destroy(); diff --git a/src/CuBaseLib/cumatrix.tcc b/src/CuBaseLib/cumatrix.tcc index 7d6a136..66e335d 100644 --- a/src/CuBaseLib/cumatrix.tcc +++ b/src/CuBaseLib/cumatrix.tcc @@ -41,13 +41,13 @@ namespace TNet { template<typename _ElemT> CuMatrix<_ElemT>& CuMatrix<_ElemT>:: - Init(CuMatrix<_ElemT>& rSrc, size_t x, size_t cols) + Init(const CuMatrix<_ElemT>& rSrc, size_t x, size_t cols) { mRows = rSrc.Rows(); mCols = cols; mStride = rSrc.Stride(); - mpCUData = rSrc.pCUData() + x; - isOwn=false; + mpCUData = const_cast<_ElemT*>(rSrc.pCUData()) + x; + isOwn = false; return *this; } @@ -57,13 +57,13 @@ namespace TNet { template<typename _ElemT> CuMatrix<_ElemT>& CuMatrix<_ElemT>:: - Init(CuMatrix<_ElemT>& rSrc) + Init(const CuMatrix<_ElemT>& rSrc) { mRows = rSrc.Rows(); mCols = rSrc.Cols(); mStride = rSrc.Stride(); - mpCUData = rSrc.pCUData(); - isOwn=false; + mpCUData = const_cast<_ElemT*>(rSrc.pCUData()); + isOwn = false; return *this; } |