Skip to content

Commit 1e11657

Browse files
csukuangfjalalek
authored andcommitted
Merge pull request opencv#8197 from csukuangfj/csukuangfj-patch-1
Fix typos in the documentation for AutoBuffer. (opencv#8197) * Allocate 1000 floats to match the documentation Fix the documentation of `AutoBuffer`. By default, the following code ```.cpp cv::AutoBuffer<float> 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.
1 parent 642e4d9 commit 1e11657

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/core/include/opencv2/core/utility.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ CV_EXPORTS void setUseCollection(bool flag); // set implementation collection st
102102
\code
103103
void my_func(const cv::Mat& m)
104104
{
105-
cv::AutoBuffer<float> buf; // create automatic buffer containing 1000 floats
105+
cv::AutoBuffer<float> buf(1000); // create automatic buffer containing 1000 floats
106106
107107
buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used,
108108
// otherwise the buffer of "m.rows" floats will be allocated
@@ -137,17 +137,17 @@ template<typename _Tp, size_t fixed_size = 1024/sizeof(_Tp)+8> class AutoBuffer
137137
void resize(size_t _size);
138138
//! returns the current buffer size
139139
size_t size() const;
140-
//! returns pointer to the real buffer, stack-allocated or head-allocated
140+
//! returns pointer to the real buffer, stack-allocated or heap-allocated
141141
operator _Tp* ();
142-
//! returns read-only pointer to the real buffer, stack-allocated or head-allocated
142+
//! returns read-only pointer to the real buffer, stack-allocated or heap-allocated
143143
operator const _Tp* () const;
144144

145145
protected:
146146
//! pointer to the real buffer, can point to buf if the buffer is small enough
147147
_Tp* ptr;
148148
//! size of the real buffer
149149
size_t sz;
150-
//! pre-allocated buffer. At least 1 element to confirm C++ standard reqirements
150+
//! pre-allocated buffer. At least 1 element to confirm C++ standard requirements
151151
_Tp buf[(fixed_size > 0) ? fixed_size : 1];
152152
};
153153

0 commit comments

Comments
 (0)