Opened 12 years ago

Closed 12 years ago

#4195 closed Bugs (fixed)

boost::circular_buffer documentation error

Reported by: anonymous Owned by: Jan Gaspar
Milestone: Boost 1.43.0 Component: circular_buffer
Version: Boost 1.42.0 Severity: Cosmetic
Keywords: Cc:

Description

The documentation for circular_buffer::array_one() implies that the second component of the array_range type refers to the number of bytes pointed to, while in fact it is the number of entries.

Change History (4)

comment:1 by nstewart@…, 12 years ago

I don't see how the documentation implies bytes. In C++ it's normal for "size" to refer to the number of elements. Such as std::vector<T>::size.

Requesting clarification - can you be more specific?

in reply to:  1 comment:2 by anonymous, 12 years ago

Resolution: worksforme
Status: newclosed

Replying to nstewart@…:

I don't see how the documentation implies bytes. In C++ it's normal for "size" to refer to the number of elements. Such as std::vector<T>::size.

Requesting clarification - can you be more specific?

The documentation gives the following example.

int write(int file_desc, char* buff, int num_bytes); array_range ar = buff.array_one(); write(file_desc, ar.first, ar.second); ar = buff.array_two(); write(file_desc, ar.first, ar.second);

The num_bytes implied to me that circular_buffer::array_one::second returns the number of bytes.

comment:3 by nstewart@…, 12 years ago

Resolution: worksforme
Status: closedreopened

Do you think this clarification would be the right solution?

write(file_desc, ar.first, ar.second)

->

write(file_desc, ar.first, ar.second*sizeof(circular_buffer<T>::value))

in reply to:  3 comment:4 by anonymous, 12 years ago

Resolution: fixed
Status: reopenedclosed

Replying to nstewart@…:

Do you think this clarification would be the right solution?

write(file_desc, ar.first, ar.second)

->

write(file_desc, ar.first, ar.second*sizeof(circular_buffer<T>::value))

Perfect.

Note: See TracTickets for help on using tickets.