mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 06:26:29 +08:00
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<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.
This commit is contained in:
parent
642e4d97a4
commit
1e11657ba4
@ -102,7 +102,7 @@ CV_EXPORTS void setUseCollection(bool flag); // set implementation collection st
|
||||
\code
|
||||
void my_func(const cv::Mat& m)
|
||||
{
|
||||
cv::AutoBuffer<float> buf; // create automatic buffer containing 1000 floats
|
||||
cv::AutoBuffer<float> 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];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user