Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:55:54

0001 //  Boost string_algo library erase.hpp header file  ---------------------------//
0002 
0003 //  Copyright Pavol Droba 2002-2006.
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 //  See http://www.boost.org/ for updates, documentation, and revision history.
0010 
0011 #ifndef BOOST_STRING_ERASE_HPP
0012 #define BOOST_STRING_ERASE_HPP
0013 
0014 #include <boost/algorithm/string/config.hpp>
0015 
0016 #include <boost/range/iterator_range_core.hpp>
0017 #include <boost/range/begin.hpp>
0018 #include <boost/range/end.hpp>
0019 #include <boost/range/iterator.hpp>
0020 #include <boost/range/const_iterator.hpp>
0021 
0022 #include <boost/algorithm/string/find_format.hpp>
0023 #include <boost/algorithm/string/finder.hpp>
0024 #include <boost/algorithm/string/formatter.hpp>
0025 
0026 /*! \file
0027     Defines various erase algorithms. Each algorithm removes
0028     part(s) of the input according to a searching criteria.
0029 */
0030 
0031 namespace boost {
0032     namespace algorithm {
0033 
0034 //  erase_range -------------------------------------------------------//
0035 
0036         //! Erase range algorithm
0037         /*!
0038             Remove the given range from the input. The result is a modified copy of 
0039             the input. It is returned as a sequence or copied to the output iterator.
0040     
0041             \param Output An output iterator to which the result will be copied
0042             \param Input An input sequence
0043             \param SearchRange A range in the input to be removed
0044             \return An output iterator pointing just after the last inserted character or
0045                 a modified copy of the input
0046 
0047             \note The second variant of this function provides the strong exception-safety guarantee
0048         */
0049         template<typename OutputIteratorT, typename RangeT>
0050         inline OutputIteratorT erase_range_copy(
0051             OutputIteratorT Output,
0052             const RangeT& Input,
0053             const iterator_range<
0054                 BOOST_STRING_TYPENAME 
0055                     range_const_iterator<RangeT>::type>& SearchRange )
0056         {
0057             return ::boost::algorithm::find_format_copy(
0058                 Output,
0059                 Input,
0060                 ::boost::algorithm::range_finder(SearchRange),
0061                 ::boost::algorithm::empty_formatter(Input) );
0062         }
0063 
0064         //! Erase range algorithm
0065         /*!
0066             \overload
0067         */
0068         template<typename SequenceT>
0069         inline SequenceT erase_range_copy( 
0070             const SequenceT& Input,
0071             const iterator_range<
0072                 BOOST_STRING_TYPENAME 
0073                     range_const_iterator<SequenceT>::type>& SearchRange )
0074         {
0075             return ::boost::algorithm::find_format_copy( 
0076                 Input,
0077                 ::boost::algorithm::range_finder(SearchRange),
0078                 ::boost::algorithm::empty_formatter(Input) );
0079         }
0080 
0081         //! Erase range algorithm
0082         /*!
0083             Remove the given range from the input.
0084             The input sequence is modified in-place.
0085 
0086             \param Input An input sequence
0087             \param SearchRange A range in the input to be removed
0088         */
0089         template<typename SequenceT>
0090         inline void erase_range( 
0091             SequenceT& Input,
0092             const iterator_range<
0093                 BOOST_STRING_TYPENAME 
0094                     range_iterator<SequenceT>::type>& SearchRange )
0095         {
0096             ::boost::algorithm::find_format( 
0097                 Input, 
0098                 ::boost::algorithm::range_finder(SearchRange),
0099                 ::boost::algorithm::empty_formatter(Input) );
0100         }
0101 
0102 //  erase_first  --------------------------------------------------------//
0103 
0104         //! Erase first algorithm
0105         /*!
0106             Remove the first occurrence of the substring from the input.
0107             The result is a modified copy of the input. It is returned as a sequence 
0108             or copied to the output iterator.
0109 
0110             \param Output An output iterator to which the result will be copied
0111             \param Input An input string
0112             \param Search A substring to be searched for 
0113             \return An output iterator pointing just after the last inserted character or
0114                 a modified copy of the input
0115             
0116             \note The second variant of this function provides the strong exception-safety guarantee
0117         */
0118         template<
0119             typename OutputIteratorT,
0120             typename Range1T, 
0121             typename Range2T>
0122         inline OutputIteratorT erase_first_copy(
0123             OutputIteratorT Output,
0124             const Range1T& Input,
0125             const Range2T& Search )
0126         {
0127             return ::boost::algorithm::find_format_copy(
0128                 Output,
0129                 Input,
0130                 ::boost::algorithm::first_finder(Search),
0131                 ::boost::algorithm::empty_formatter(Input) );
0132         }
0133 
0134         //! Erase first algorithm
0135         /*!
0136             \overload
0137         */
0138         template<typename SequenceT, typename RangeT>
0139         inline SequenceT erase_first_copy( 
0140             const SequenceT& Input,
0141             const RangeT& Search )
0142         {
0143             return ::boost::algorithm::find_format_copy( 
0144                 Input, 
0145                 ::boost::algorithm::first_finder(Search),
0146                 ::boost::algorithm::empty_formatter(Input) );
0147         }
0148 
0149         //! Erase first algorithm
0150         /*!
0151             Remove the first occurrence of the substring from the input. 
0152             The input sequence is modified in-place.
0153 
0154             \param Input An input string
0155             \param Search A substring to be searched for. 
0156         */
0157         template<typename SequenceT, typename RangeT>
0158         inline void erase_first( 
0159             SequenceT& Input,
0160             const RangeT& Search )
0161         {
0162             ::boost::algorithm::find_format( 
0163                 Input, 
0164                 ::boost::algorithm::first_finder(Search),
0165                 ::boost::algorithm::empty_formatter(Input) );
0166         }
0167 
0168 //  erase_first ( case insensitive ) ------------------------------------//
0169 
0170         //! Erase first algorithm ( case insensitive )
0171         /*!
0172             Remove the first occurrence of the substring from the input. 
0173             The result is a modified copy of the input. It is returned as a sequence 
0174             or copied to the output iterator.
0175             Searching is case insensitive.
0176 
0177             \param Output An output iterator to which the result will be copied
0178             \param Input An input string
0179             \param Search A substring to be searched for 
0180             \param Loc A locale used for case insensitive comparison
0181             \return An output iterator pointing just after the last inserted character or
0182                 a modified copy of the input
0183 
0184             \note The second variant of this function provides the strong exception-safety guarantee
0185         */
0186         template<
0187             typename OutputIteratorT,
0188             typename Range1T, 
0189             typename Range2T>
0190         inline OutputIteratorT ierase_first_copy(
0191             OutputIteratorT Output,
0192             const Range1T& Input,
0193             const Range2T& Search,
0194             const std::locale& Loc=std::locale() )
0195         {
0196             return ::boost::algorithm::find_format_copy(
0197                 Output,
0198                 Input,
0199                 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0200                 ::boost::algorithm::empty_formatter(Input) );
0201         }
0202 
0203         //! Erase first algorithm ( case insensitive )
0204         /*!
0205             \overload
0206         */
0207         template<typename SequenceT, typename RangeT>
0208         inline SequenceT ierase_first_copy( 
0209             const SequenceT& Input,
0210             const RangeT& Search,
0211             const std::locale& Loc=std::locale() )
0212         {
0213             return ::boost::algorithm::find_format_copy( 
0214                 Input, 
0215                 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0216                 ::boost::algorithm::empty_formatter(Input) );
0217         }
0218 
0219         //! Erase first algorithm ( case insensitive )
0220         /*!
0221             Remove the first occurrence of the substring from the input. 
0222             The input sequence is modified in-place. Searching is case insensitive.
0223 
0224             \param Input An input string
0225             \param Search A substring to be searched for
0226             \param Loc A locale used for case insensitive comparison
0227         */
0228         template<typename SequenceT, typename RangeT>
0229         inline void ierase_first( 
0230             SequenceT& Input,
0231             const RangeT& Search,
0232             const std::locale& Loc=std::locale() )
0233         {
0234             ::boost::algorithm::find_format( 
0235                 Input, 
0236                 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0237                 ::boost::algorithm::empty_formatter(Input) );
0238         }
0239 
0240 //  erase_last  --------------------------------------------------------//
0241 
0242         //! Erase last algorithm
0243         /*!
0244             Remove the last occurrence of the substring from the input. 
0245             The result is a modified copy of the input. It is returned as a sequence 
0246             or copied to the output iterator.
0247 
0248             \param Output An output iterator to which the result will be copied
0249             \param Input An input string
0250             \param Search A substring to be searched for.
0251             \return An output iterator pointing just after the last inserted character or
0252                 a modified copy of the input
0253 
0254              \note The second variant of this function provides the strong exception-safety guarantee
0255         */
0256         template<
0257             typename OutputIteratorT,
0258             typename Range1T, 
0259             typename Range2T>
0260         inline OutputIteratorT erase_last_copy(
0261             OutputIteratorT Output,
0262             const Range1T& Input,
0263             const Range2T& Search )
0264         {
0265             return ::boost::algorithm::find_format_copy(
0266                 Output,
0267                 Input,
0268                 ::boost::algorithm::last_finder(Search),
0269                 ::boost::algorithm::empty_formatter(Input) );
0270         }
0271 
0272         //! Erase last algorithm
0273         /*!
0274             \overload
0275         */
0276         template<typename SequenceT, typename RangeT>
0277         inline SequenceT erase_last_copy( 
0278             const SequenceT& Input,
0279             const RangeT& Search )
0280         {
0281             return ::boost::algorithm::find_format_copy( 
0282                 Input, 
0283                 ::boost::algorithm::last_finder(Search),
0284                 ::boost::algorithm::empty_formatter(Input) );
0285         }
0286 
0287         //! Erase last algorithm
0288         /*!
0289             Remove the last occurrence of the substring from the input. 
0290             The input sequence is modified in-place.
0291 
0292             \param Input An input string
0293             \param Search A substring to be searched for 
0294         */
0295         template<typename SequenceT, typename RangeT>
0296         inline void erase_last( 
0297             SequenceT& Input,
0298             const RangeT& Search )
0299         {
0300             ::boost::algorithm::find_format( 
0301                 Input, 
0302                 ::boost::algorithm::last_finder(Search),
0303                 ::boost::algorithm::empty_formatter(Input) );
0304         }
0305 
0306 //  erase_last ( case insensitive ) ------------------------------------//
0307 
0308         //! Erase last algorithm ( case insensitive )
0309         /*!
0310             Remove the last occurrence of the substring from the input. 
0311             The result is a modified copy of the input. It is returned as a sequence 
0312             or copied to the output iterator.
0313             Searching is case insensitive.
0314 
0315             \param Output An output iterator to which the result will be copied
0316             \param Input An input string
0317             \param Search A substring to be searched for
0318             \param Loc A locale used for case insensitive comparison
0319             \return An output iterator pointing just after the last inserted character or
0320                 a modified copy of the input
0321 
0322              \note The second variant of this function provides the strong exception-safety guarantee
0323         */
0324         template<
0325             typename OutputIteratorT,
0326             typename Range1T, 
0327             typename Range2T>
0328         inline OutputIteratorT ierase_last_copy(
0329             OutputIteratorT Output,
0330             const Range1T& Input,
0331             const Range2T& Search,
0332             const std::locale& Loc=std::locale() )
0333         {
0334             return ::boost::algorithm::find_format_copy(
0335                 Output,
0336                 Input,
0337                 ::boost::algorithm::last_finder(Search, is_iequal(Loc)),
0338                 ::boost::algorithm::empty_formatter(Input) );
0339         }
0340 
0341         //! Erase last algorithm ( case insensitive )
0342         /*!
0343             \overload
0344         */
0345         template<typename SequenceT, typename RangeT>
0346         inline SequenceT ierase_last_copy( 
0347             const SequenceT& Input,
0348             const RangeT& Search,
0349             const std::locale& Loc=std::locale() )
0350         {
0351             return ::boost::algorithm::find_format_copy( 
0352                 Input, 
0353                 ::boost::algorithm::last_finder(Search, is_iequal(Loc)),
0354                 ::boost::algorithm::empty_formatter(Input) );
0355         }
0356 
0357         //! Erase last algorithm ( case insensitive )
0358         /*!
0359             Remove the last occurrence of the substring from the input. 
0360             The input sequence is modified in-place. Searching is case insensitive.
0361 
0362             \param Input An input string
0363             \param Search A substring to be searched for
0364             \param Loc A locale used for case insensitive comparison
0365         */
0366         template<typename SequenceT, typename RangeT>
0367         inline void ierase_last( 
0368             SequenceT& Input,
0369             const RangeT& Search,
0370             const std::locale& Loc=std::locale() )
0371         {
0372             ::boost::algorithm::find_format( 
0373                 Input, 
0374                 ::boost::algorithm::last_finder(Search, is_iequal(Loc)),
0375                 ::boost::algorithm::empty_formatter(Input) );
0376         }
0377 
0378 //  erase_nth --------------------------------------------------------------------//
0379 
0380         //! Erase nth algorithm
0381         /*!
0382             Remove the Nth occurrence of the substring in the input.
0383             The result is a modified copy of the input. It is returned as a sequence 
0384             or copied to the output iterator.
0385             
0386 
0387             \param Output An output iterator to which the result will be copied
0388             \param Input An input string
0389             \param Search A substring to be searched for
0390             \param Nth An index of the match to be replaced. The index is 0-based.
0391                 For negative N, matches are counted from the end of string.
0392             \return An output iterator pointing just after the last inserted character or
0393                 a modified copy of the input
0394 
0395              \note The second variant of this function provides the strong exception-safety guarantee
0396         */
0397         template<
0398             typename OutputIteratorT,
0399             typename Range1T, 
0400             typename Range2T>
0401         inline OutputIteratorT erase_nth_copy(
0402             OutputIteratorT Output,
0403             const Range1T& Input,
0404             const Range2T& Search,
0405             int Nth )
0406         {
0407             return ::boost::algorithm::find_format_copy(
0408                 Output,
0409                 Input,
0410                 ::boost::algorithm::nth_finder(Search, Nth),
0411                 ::boost::algorithm::empty_formatter(Input) );
0412         }
0413 
0414         //! Erase nth algorithm
0415         /*!
0416             \overload
0417         */
0418         template<typename SequenceT, typename RangeT>
0419         inline SequenceT erase_nth_copy( 
0420             const SequenceT& Input,
0421             const RangeT& Search,
0422             int Nth )
0423         {
0424             return ::boost::algorithm::find_format_copy( 
0425                 Input, 
0426                 ::boost::algorithm::nth_finder(Search, Nth),
0427                 ::boost::algorithm::empty_formatter(Input) );
0428         }
0429 
0430         //! Erase nth algorithm
0431         /*!
0432             Remove the Nth occurrence of the substring in the input.
0433             The input sequence is modified in-place.
0434 
0435             \param Input An input string
0436             \param Search A substring to be searched for. 
0437             \param Nth An index of the match to be replaced. The index is 0-based.
0438                 For negative N, matches are counted from the end of string.
0439         */
0440         template<typename SequenceT, typename RangeT>
0441         inline void erase_nth( 
0442             SequenceT& Input,
0443             const RangeT& Search,
0444             int Nth )
0445         {
0446             ::boost::algorithm::find_format( 
0447                 Input, 
0448                 ::boost::algorithm::nth_finder(Search, Nth),
0449                 ::boost::algorithm::empty_formatter(Input) );
0450         }
0451 
0452 //  erase_nth ( case insensitive ) ---------------------------------------------//
0453 
0454         //! Erase nth algorithm ( case insensitive )
0455         /*!
0456             Remove the Nth occurrence of the substring in the input.
0457             The result is a modified copy of the input. It is returned as a sequence 
0458             or copied to the output iterator. 
0459             Searching is case insensitive.
0460 
0461             \param Output An output iterator to which the result will be copied
0462             \param Input An input string
0463             \param Search A substring to be searched for.
0464             \param Nth An index of the match to be replaced. The index is 0-based.
0465                 For negative N, matches are counted from the end of string.
0466             \param Loc A locale used for case insensitive comparison
0467             \return An output iterator pointing just after the last inserted character or
0468                 a modified copy of the input
0469 
0470             \note The second variant of this function provides the strong exception-safety guarantee
0471         */
0472         template<
0473             typename OutputIteratorT,
0474             typename Range1T, 
0475             typename Range2T>
0476         inline OutputIteratorT ierase_nth_copy(
0477             OutputIteratorT Output,
0478             const Range1T& Input,
0479             const Range2T& Search,
0480             int Nth,
0481             const std::locale& Loc=std::locale() )
0482         {
0483             return ::boost::algorithm::find_format_copy(
0484                 Output,
0485                 Input,
0486                 ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
0487                 ::boost::algorithm::empty_formatter(Input) );
0488         }
0489 
0490         //! Erase nth algorithm
0491         /*!
0492             \overload
0493         */
0494         template<typename SequenceT, typename RangeT>
0495         inline SequenceT ierase_nth_copy( 
0496             const SequenceT& Input,
0497             const RangeT& Search,
0498             int Nth,
0499             const std::locale& Loc=std::locale() )
0500         {
0501             return ::boost::algorithm::find_format_copy( 
0502                 Input, 
0503                 ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
0504                 empty_formatter(Input) );
0505         }
0506 
0507         //! Erase nth algorithm
0508         /*!
0509             Remove the Nth occurrence of the substring in the input.
0510             The input sequence is modified in-place. Searching is case insensitive.
0511 
0512             \param Input An input string
0513             \param Search A substring to be searched for. 
0514             \param Nth An index of the match to be replaced. The index is 0-based.
0515                 For negative N, matches are counted from the end of string.
0516             \param Loc A locale used for case insensitive comparison
0517         */
0518         template<typename SequenceT, typename RangeT>
0519         inline void ierase_nth( 
0520             SequenceT& Input,
0521             const RangeT& Search,
0522             int Nth,
0523             const std::locale& Loc=std::locale() )
0524         {
0525             ::boost::algorithm::find_format( 
0526                 Input, 
0527                 ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
0528                 ::boost::algorithm::empty_formatter(Input) );
0529         }
0530 
0531 
0532 //  erase_all  --------------------------------------------------------//
0533 
0534         //! Erase all algorithm
0535         /*!
0536             Remove all the occurrences of the string from the input. 
0537             The result is a modified copy of the input. It is returned as a sequence 
0538             or copied to the output iterator.
0539                         
0540 
0541             \param Output An output iterator to which the result will be copied
0542             \param Input An input sequence
0543             \param Search A substring to be searched for. 
0544             \return An output iterator pointing just after the last inserted character or
0545                     a modified copy of the input
0546 
0547             \note The second variant of this function provides the strong exception-safety guarantee
0548         */
0549         template<
0550             typename OutputIteratorT,
0551             typename Range1T, 
0552             typename Range2T>
0553         inline OutputIteratorT erase_all_copy(
0554             OutputIteratorT Output,
0555             const Range1T& Input,
0556             const Range2T& Search )
0557         {
0558             return ::boost::algorithm::find_format_all_copy(
0559                 Output,
0560                 Input,
0561                 ::boost::algorithm::first_finder(Search),
0562                 ::boost::algorithm::empty_formatter(Input) );
0563         }
0564 
0565         //! Erase all algorithm
0566         /*!
0567             \overload
0568         */  
0569         template<typename SequenceT, typename RangeT>
0570         inline SequenceT erase_all_copy( 
0571             const SequenceT& Input,
0572             const RangeT& Search )
0573         {
0574             return ::boost::algorithm::find_format_all_copy( 
0575                 Input, 
0576                 ::boost::algorithm::first_finder(Search),
0577                 ::boost::algorithm::empty_formatter(Input) );
0578         }
0579 
0580         //! Erase all algorithm
0581         /*!
0582             Remove all the occurrences of the string from the input. 
0583             The input sequence is modified in-place.
0584 
0585             \param Input An input string
0586             \param Search A substring to be searched for. 
0587         */
0588         template<typename SequenceT, typename RangeT>
0589         inline void erase_all( 
0590             SequenceT& Input,
0591             const RangeT& Search )
0592         {
0593             ::boost::algorithm::find_format_all( 
0594                 Input, 
0595                 ::boost::algorithm::first_finder(Search),
0596                 ::boost::algorithm::empty_formatter(Input) );
0597         }
0598 
0599 //  erase_all ( case insensitive ) ------------------------------------//
0600 
0601         //! Erase all algorithm ( case insensitive )
0602         /*!
0603             Remove all the occurrences of the string from the input. 
0604             The result is a modified copy of the input. It is returned as a sequence 
0605             or copied to the output iterator. 
0606             Searching is case insensitive.
0607 
0608             \param Output An output iterator to which the result will be copied
0609             \param Input An input string
0610             \param Search A substring to be searched for
0611             \param Loc A locale used for case insensitive comparison
0612             \return An output iterator pointing just after the last inserted character or
0613                     a modified copy of the input
0614 
0615               \note The second variant of this function provides the strong exception-safety guarantee
0616         */
0617         template<
0618             typename OutputIteratorT,
0619             typename Range1T, 
0620             typename Range2T>
0621         inline OutputIteratorT ierase_all_copy(
0622             OutputIteratorT Output,
0623             const Range1T& Input,
0624             const Range2T& Search,
0625             const std::locale& Loc=std::locale() )
0626         {
0627             return ::boost::algorithm::find_format_all_copy(
0628                 Output,
0629                 Input,
0630                 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0631                 ::boost::algorithm::empty_formatter(Input) );
0632         }
0633 
0634         //! Erase all algorithm ( case insensitive )
0635         /*!
0636             \overload
0637         */
0638         template<typename SequenceT, typename RangeT>
0639         inline SequenceT ierase_all_copy( 
0640             const SequenceT& Input,
0641             const RangeT& Search,
0642             const std::locale& Loc=std::locale() )
0643         {
0644             return ::boost::algorithm::find_format_all_copy( 
0645                 Input, 
0646                 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0647                 ::boost::algorithm::empty_formatter(Input) );
0648         }
0649 
0650         //! Erase all algorithm ( case insensitive )
0651         /*!
0652             Remove all the occurrences of the string from the input. 
0653             The input sequence is modified in-place. Searching is case insensitive.
0654 
0655             \param Input An input string
0656             \param Search A substring to be searched for. 
0657             \param Loc A locale used for case insensitive comparison
0658         */
0659         template<typename SequenceT, typename RangeT>
0660         inline void ierase_all( 
0661             SequenceT& Input,
0662             const RangeT& Search,
0663             const std::locale& Loc=std::locale() )
0664         {
0665             ::boost::algorithm::find_format_all( 
0666                 Input, 
0667                 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0668                 ::boost::algorithm::empty_formatter(Input) );
0669         }
0670 
0671 //  erase_head --------------------------------------------------------------------//
0672 
0673         //! Erase head algorithm
0674         /*!
0675             Remove the head from the input. The head is a prefix of a sequence of given size. 
0676             If the sequence is shorter then required, the whole string is 
0677             considered to be the head. The result is a modified copy of the input. 
0678             It is returned as a sequence or copied to the output iterator.
0679             
0680 
0681             \param Output An output iterator to which the result will be copied
0682             \param Input An input string
0683             \param N Length of the head.
0684                 For N>=0, at most N characters are extracted.
0685                 For N<0, size(Input)-|N| characters are extracted.
0686             \return An output iterator pointing just after the last inserted character or
0687                 a modified copy of the input
0688 
0689              \note The second variant of this function provides the strong exception-safety guarantee
0690         */
0691         template<
0692             typename OutputIteratorT,
0693             typename RangeT>
0694         inline OutputIteratorT erase_head_copy(
0695             OutputIteratorT Output,
0696             const RangeT& Input,
0697             int N )
0698         {
0699             return ::boost::algorithm::find_format_copy(
0700                 Output,
0701                 Input,
0702                 ::boost::algorithm::head_finder(N),
0703                 ::boost::algorithm::empty_formatter( Input ) );
0704         }
0705 
0706         //! Erase head algorithm
0707         /*!
0708             \overload
0709         */
0710         template<typename SequenceT>
0711         inline SequenceT erase_head_copy( 
0712             const SequenceT& Input,
0713             int N )
0714         {
0715             return ::boost::algorithm::find_format_copy( 
0716                 Input,
0717                 ::boost::algorithm::head_finder(N),
0718                 ::boost::algorithm::empty_formatter( Input ) );
0719         }
0720 
0721         //! Erase head algorithm
0722         /*!
0723             Remove the head from the input. The head is a prefix of a sequence of given size. 
0724             If the sequence is shorter then required, the whole string is 
0725             considered to be the head. The input sequence is modified in-place.
0726 
0727             \param Input An input string
0728             \param N Length of the head
0729                 For N>=0, at most N characters are extracted.
0730                 For N<0, size(Input)-|N| characters are extracted.
0731         */
0732         template<typename SequenceT>
0733         inline void erase_head( 
0734             SequenceT& Input,
0735             int N )
0736         {
0737             ::boost::algorithm::find_format( 
0738                 Input, 
0739                 ::boost::algorithm::head_finder(N),
0740                 ::boost::algorithm::empty_formatter( Input ) );
0741         }
0742 
0743 //  erase_tail --------------------------------------------------------------------//
0744 
0745         //! Erase tail algorithm
0746         /*!
0747             Remove the tail from the input. The tail is a suffix of a sequence of given size. 
0748             If the sequence is shorter then required, the whole string is 
0749             considered to be the tail. 
0750             The result is a modified copy of the input. It is returned as a sequence 
0751             or copied to the output iterator.
0752 
0753             \param Output An output iterator to which the result will be copied
0754             \param Input An input string
0755             \param N Length of the tail.                 
0756                 For N>=0, at most N characters are extracted.
0757                 For N<0, size(Input)-|N| characters are extracted.
0758             \return An output iterator pointing just after the last inserted character or
0759                 a modified copy of the input
0760             
0761              \note The second variant of this function provides the strong exception-safety guarantee
0762         */
0763         template<
0764             typename OutputIteratorT,
0765             typename RangeT>
0766         inline OutputIteratorT erase_tail_copy(
0767             OutputIteratorT Output,
0768             const RangeT& Input,
0769             int N )
0770         {
0771             return ::boost::algorithm::find_format_copy(
0772                 Output,
0773                 Input,
0774                 ::boost::algorithm::tail_finder(N),
0775                 ::boost::algorithm::empty_formatter( Input ) );
0776         }
0777 
0778         //! Erase tail algorithm
0779         /*!
0780             \overload
0781         */
0782         template<typename SequenceT>
0783         inline SequenceT erase_tail_copy( 
0784             const SequenceT& Input,
0785             int N )
0786         {
0787             return ::boost::algorithm::find_format_copy( 
0788                 Input,
0789                 ::boost::algorithm::tail_finder(N),
0790                 ::boost::algorithm::empty_formatter( Input ) );
0791         }
0792 
0793         //! Erase tail algorithm
0794         /*!
0795             Remove the tail from the input. The tail is a suffix of a sequence of given size. 
0796             If the sequence is shorter then required, the whole string is
0797             considered to be the tail. The input sequence is modified in-place.
0798 
0799             \param Input An input string
0800             \param N Length of the tail
0801                 For N>=0, at most N characters are extracted.
0802                 For N<0, size(Input)-|N| characters are extracted.
0803         */
0804         template<typename SequenceT>
0805         inline void erase_tail( 
0806             SequenceT& Input,
0807             int N )
0808         {
0809             ::boost::algorithm::find_format( 
0810                 Input, 
0811                 ::boost::algorithm::tail_finder(N),
0812                 ::boost::algorithm::empty_formatter( Input ) );
0813         }
0814 
0815     } // namespace algorithm
0816 
0817     // pull names into the boost namespace
0818     using algorithm::erase_range_copy;
0819     using algorithm::erase_range;
0820     using algorithm::erase_first_copy;
0821     using algorithm::erase_first;
0822     using algorithm::ierase_first_copy;
0823     using algorithm::ierase_first;
0824     using algorithm::erase_last_copy;
0825     using algorithm::erase_last;
0826     using algorithm::ierase_last_copy;
0827     using algorithm::ierase_last;
0828     using algorithm::erase_nth_copy;
0829     using algorithm::erase_nth;
0830     using algorithm::ierase_nth_copy;
0831     using algorithm::ierase_nth;
0832     using algorithm::erase_all_copy;
0833     using algorithm::erase_all;
0834     using algorithm::ierase_all_copy;
0835     using algorithm::ierase_all;
0836     using algorithm::erase_head_copy;
0837     using algorithm::erase_head;
0838     using algorithm::erase_tail_copy;
0839     using algorithm::erase_tail;
0840 
0841 } // namespace boost
0842 
0843 
0844 #endif  // BOOST_ERASE_HPP