Type: info Title: ::comphelper::StlUnoSequence Posted by: [EMAIL PROTECTED] Affected: - Effective from: CWS stl_iterators / MWS DEV300 m13
*Summary* -------- a wrapper-class that provides stl-container-like access to an existing ::com::sun::star::uno::Sequence and shortcuts to stl iterators on the begin and end of ::com::sun::star::uno::Sequence (this does not allow inserts/size change however - see description) *Description* ------------- This template class allows using an existing ::com::sun::star::uno::Sequence like any other stl container. It provides standard-compliant mutable random access iterators. Because random access iterators are the most generic iterators defined by the stl, any stl algorithm can be applied to the Sequence. This is just a basic stl forward container, but _not_ an stl sequence (the size of the ::com::sun::star::uno::Sequence cannot be changed using the StlUnoSequence interface). Inserts are expensive operations on ::com::sun::star::uno::Sequence - use ::std::copy() to a efficient stl container implementing the stl sequence interface and the available insert iterator adapters you need those. There are ::comphelper::stl_begin() and ::comphelper::stl_end() serving as direct shortcuts to stl iterators of a sequence. Example: (creating a ::std::list from a ::com::sun::star::uno::Sequence) ::com::sun::star::uno::Sequence<sal_Int32> uno_seq(10); std::list stl_list(::comphelper::stl_begin(&uno_seq), ::comphelper::stl_end(&uno_seq)); Example: (counting occurrences of 4711 in a ::com::sun::star::uno::Sequence) ::com::sun::star::uno::Sequence<sal_Int32> uno_seq(10); sal_Int32 count = 0; ::std::count(::comphelper::stl_begin(&uno_seq), ::comphelper::stl_end(&uno_seq), 4711, count); Example: (sorting ::com::sun::star::uno::Sequence inplace) ::com::sun::star::uno::Sequence<sal_Int32> uno_seq(10); ::comphelper::StlUnoSequence<sal_Int32> stl_seq = ::comphelper::StlUnoSequence<sal_Int32>::createInstance(&uno_seq); ::std::sort(stl_seq.begin(), stl_seq.end()); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]