diff --git a/image.cpp b/image.cpp index a48ad4ee..2cde6f83 100644 --- a/image.cpp +++ b/image.cpp @@ -255,7 +255,7 @@ util::image::buffer::downsample (float factor) const /////////////////////////////////////////////////////////////////////////////// template -T +const T& buffer::operator[] (point<2,size_t> p) const { CHECK_LT (p.x, w); @@ -279,7 +279,7 @@ buffer::operator[] (point<2,size_t> p) //----------------------------------------------------------------------------- template -T +const T& buffer::operator[] (size_t idx) const { CHECK_LT (idx, h * s); @@ -354,6 +354,7 @@ buffer::end (void) const //----------------------------------------------------------------------------- +template struct util::image::buffer; template struct util::image::buffer; template struct util::image::buffer; template struct util::image::buffer; diff --git a/image.hpp b/image.hpp index ff134fec..3b59e5ce 100644 --- a/image.hpp +++ b/image.hpp @@ -63,10 +63,10 @@ namespace util { namespace image { //--------------------------------------------------------------------- constexpr size_t offset (point<2,size_t>) const; - T operator[] (point<2,size_t>) const; + const T& operator[] (point<2,size_t>) const; T& operator[] (point<2,size_t>); - T operator[] (size_t) const; + const T& operator[] (size_t) const; T& operator[] (size_t); //---------------------------------------------------------------------