Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77537 - trunk/libs/conversion/doc
From: antoshkka_at_[hidden]
Date: 2012-03-25 01:31:44


Author: apolukhin
Date: 2012-03-25 01:31:43 EDT (Sun, 25 Mar 2012)
New Revision: 77537
URL: http://svn.boost.org/trac/boost/changeset/77537

Log:
Small documentation updates for #6663
Text files modified:
   trunk/libs/conversion/doc/lexical_cast.qbk | 12 ++++++------
   1 files changed, 6 insertions(+), 6 deletions(-)

Modified: trunk/libs/conversion/doc/lexical_cast.qbk
==============================================================================
--- trunk/libs/conversion/doc/lexical_cast.qbk (original)
+++ trunk/libs/conversion/doc/lexical_cast.qbk 2012-03-25 01:31:43 EDT (Sun, 25 Mar 2012)
@@ -132,22 +132,22 @@
             return non_zero_terminated_data;
         }
 
- std::size_t length() const {
+ std::size_t size() const {
             return data_length;
         }
     };
     
     inline std::ostream& operator << (std::ostream& ostr, const example_class& rhs) {
- return ostr << boost::make_iterator_range(rhs.data(), rhs.data() + rhs.length());
+ return ostr << boost::make_iterator_range(rhs.data(), rhs.data() + rhs.size());
     }
 ``
 
 This is a good generic solution for most use cases.
 But we can make it even faster for some performance critical applications. During conversion, we loose speed at:
 
-* `std::basic_ostream<CharT>` construction (it makes some heap allocations)
-* `operator <<` (it copyies one by one all the symbols to an instance of `std::basic_ostream<CharT>`)
-* `std::basic_ostream<CharT>` destruction (it makes some heap deallocations)
+* `std::ostream` construction (it makes some heap allocations)
+* `operator <<` (it copyies one by one all the symbols to an instance of `std::ostream`)
+* `std::ostream` destruction (it makes some heap deallocations)
 
 We can avoid all of this, by specifieng an overload for `boost::lexical_cast`:
 ``
@@ -155,7 +155,7 @@
     template <class OutT>
     OutT lexical_cast(const example_class& rhs) {
         return boost::lexical_cast<OutT>(
- boost::make_iterator_range(rhs.data(), rhs.data() + rhs.length())
+ boost::make_iterator_range(rhs.data(), rhs.data() + rhs.size())
         );
     }
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk