|
Boost : |
Subject: [boost] Documenting and checking template parameters
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2013-05-26 05:14:13
I am just refactoring the venerable circular_buffer documentation.
The docs describe the Template parameter T and specify it thus:
The type of the elements stored in the circular_buffer. The T has to be SGIAssignable (SGI STL
defined combination of Assignable and CopyConstructible).
Moreover T has to be DefaultConstructible if supplied as a default parameter when invoking some of
the circular_buffer's methods e.g. insert(iterator pos, const value_type& item = value_type()).
And EqualityComparable and/or LessThanComparable if the circular_buffer will be compared with
another container.
This looks a bit out of date?
Questions:
How should a parameter like this *best* be described in documentation and enforced in software?
http://www.boost.org/doc/libs/1_53_0/doc/html/Assignable.html ?
http://www.boost.org/doc/libs/1_53_0/libs/concept_check/concept_check.htm ?
Should these concepts be checked using BOOST_STATIC_ASSERT?
Should *All* these be checked, even though not required for all uses?
Suggestions welcome.
Thanks
Paul
--- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk