From 1e11657ba495fb6a002d29945547e0dd71b90b2b Mon Sep 17 00:00:00 2001 From: Fangjun KUANG Date: Mon, 13 Feb 2017 11:58:44 +0100 Subject: [PATCH] Merge pull request #8197 from csukuangfj/csukuangfj-patch-1 Fix typos in the documentation for AutoBuffer. (#8197) * Allocate 1000 floats to match the documentation Fix the documentation of `AutoBuffer`. By default, the following code ```.cpp cv::AutoBuffer m; ```` allocates only 264 floats. But the comment in the demonstration code says it allocates 1000 floats, which is not correct. * fix typo in the comment. --- modules/core/include/opencv2/core/utility.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/core/include/opencv2/core/utility.hpp b/modules/core/include/opencv2/core/utility.hpp index e7a7c2d789..dab039c4b9 100644 --- a/modules/core/include/opencv2/core/utility.hpp +++ b/modules/core/include/opencv2/core/utility.hpp @@ -102,7 +102,7 @@ CV_EXPORTS void setUseCollection(bool flag); // set implementation collection st \code void my_func(const cv::Mat& m) { - cv::AutoBuffer buf; // create automatic buffer containing 1000 floats + cv::AutoBuffer buf(1000); // create automatic buffer containing 1000 floats buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used, // otherwise the buffer of "m.rows" floats will be allocated @@ -137,9 +137,9 @@ public: void resize(size_t _size); //! returns the current buffer size size_t size() const; - //! returns pointer to the real buffer, stack-allocated or head-allocated + //! returns pointer to the real buffer, stack-allocated or heap-allocated operator _Tp* (); - //! returns read-only pointer to the real buffer, stack-allocated or head-allocated + //! returns read-only pointer to the real buffer, stack-allocated or heap-allocated operator const _Tp* () const; protected: @@ -147,7 +147,7 @@ protected: _Tp* ptr; //! size of the real buffer size_t sz; - //! pre-allocated buffer. At least 1 element to confirm C++ standard reqirements + //! pre-allocated buffer. At least 1 element to confirm C++ standard requirements _Tp buf[(fixed_size > 0) ? fixed_size : 1]; };