Imported Upstream version 0.12.7
[bowtie.git] / SeqAn-1.1 / seqan / sequence / std_string.h
1  /*==========================================================================
2                 SeqAn - The Library for Sequence Analysis
3                           http://www.seqan.de 
4  ============================================================================
5   Copyright (C) 2007
6
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public
9   License as published by the Free Software Foundation; either
10   version 3 of the License, or (at your option) any later version.
11
12   This library is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   Lesser General Public License for more details.
16
17  ============================================================================
18   $Id: std_string.h,v 1.1 2008/08/25 16:20:04 langmead Exp $
19  ==========================================================================*/
20
21 #ifndef SEQAN_HEADER_STD_STRING_H
22 #define SEQAN_HEADER_STD_STRING_H
23
24
25 //Adaption for ::std::basic_string
26
27 #include <string>
28
29 namespace SEQAN_NAMESPACE_MAIN
30 {
31
32 //////////////////////////////////////////////////////////////////////////////
33 /**
34 .Adaption."std::basic_string":
35 ..summary:Standard library string class.
36 */
37
38
39
40 //////////////////////////////////////////////////////////////////////////////
41
42 ///.Metafunction.IsContiguous.param.T.type:Adaption.std::basic_string
43
44 template <typename  TChar, typename TCharTraits, typename TAlloc>
45 struct IsContiguous< ::std::basic_string<TChar, TCharTraits, TAlloc> >
46 {
47     enum { VALUE = true };
48 };
49
50 template <typename  TChar, typename TCharTraits, typename TAlloc>
51 struct IsContiguous< ::std::basic_string<TChar, TCharTraits, TAlloc> const>
52 {
53     enum { VALUE = true };
54 };
55
56 ///.Metafunction.Value.param.T.type:Adaption.std::basic_string
57 template <typename TChar, typename TCharTraits, typename TAlloc>
58 struct Value< ::std::basic_string<TChar, TCharTraits, TAlloc> >
59 {
60         typedef typename ::std::basic_string<TChar, TCharTraits, TAlloc>::value_type Type;
61 };
62 template <typename TChar, typename TCharTraits, typename TAlloc>
63 struct Value< ::std::basic_string<TChar, TCharTraits, TAlloc> const>
64 {
65         typedef typename ::std::basic_string<TChar, TCharTraits, TAlloc>::value_type Type;
66 };
67
68 ///.Metafunction.GetValue.param.T.type:Adaption.std::basic_string
69 template <typename TChar, typename TCharTraits, typename TAlloc>
70 struct GetValue< ::std::basic_string<TChar, TCharTraits, TAlloc> >
71 {
72         typedef typename ::std::basic_string<TChar, TCharTraits, TAlloc>::reference Type;
73 };
74 template <typename TChar, typename TCharTraits, typename TAlloc>
75 struct GetValue< ::std::basic_string<TChar, TCharTraits, TAlloc> const>
76 {
77         typedef typename ::std::basic_string<TChar, TCharTraits, TAlloc>::const_reference Type;
78 };
79
80 //???GetValue<vector<bool> > ist bool
81
82 //____________________________________________________________________________
83
84 ///.Metafunction.Iterator.param.T.type:Adaption.std::basic_string
85
86 template <typename TChar, typename TCharTraits, typename TAlloc>
87 struct Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Rooted>
88 {
89         typedef ::std::basic_string<TChar, TCharTraits, TAlloc> TString;
90         typedef Iter<TString, StdIteratorAdaptor> TIterator;
91         typedef Iter<TString, AdaptorIterator<TIterator> > Type;
92 };
93 template <typename TChar, typename TCharTraits, typename TAlloc>
94 struct Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc> const, Rooted>
95 {
96         typedef ::std::basic_string<TChar, TCharTraits, TAlloc> const TString;
97         typedef Iter<TString, StdIteratorAdaptor> TIterator;
98         typedef Iter<TString, AdaptorIterator<TIterator> > Type;
99 };
100
101
102 template <typename TChar, typename TCharTraits, typename TAlloc>
103 struct Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Standard >
104 {
105         typedef Iter< ::std::basic_string<TChar, TCharTraits, TAlloc>, StdIteratorAdaptor > Type;
106 };
107 template <typename TChar, typename TCharTraits, typename TAlloc>
108 struct Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc> const, Standard>
109 {
110         typedef Iter< ::std::basic_string<TChar, TCharTraits, TAlloc> const, StdIteratorAdaptor > Type;
111 };
112
113 //____________________________________________________________________________
114
115 ///.Metafunction.Position.param.T.type:Adaption.std::basic_string
116 template <typename TChar, typename TCharTraits, typename TAlloc>
117 struct Position< ::std::basic_string<TChar, TCharTraits, TAlloc> >
118 {
119         typedef typename ::std::basic_string<TChar, TCharTraits, TAlloc>::size_type Type;
120 };
121
122 //____________________________________________________________________________
123
124 ///.Metafunction.Size.param.T.type:Adaption.std::basic_string
125 template <typename TChar, typename TCharTraits, typename TAlloc>
126 struct Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >
127 {
128         typedef typename ::std::basic_string<TChar, TCharTraits, TAlloc>::size_type Type;
129 };
130
131 //////////////////////////////////////////////////////////////////////////////
132
133 ///.Metafunction.Size.param.T.type:Adaption.std::basic_string
134 template <typename TChar, typename TCharTraits, typename TAlloc>
135 struct DefaultOverflowImplicit< ::std::basic_string<TChar, TCharTraits, TAlloc> >
136 {
137         typedef Generous Type;
138 };
139
140 //////////////////////////////////////////////////////////////////////////////
141
142 ///.Function.id.param.object.type:Adaption.std::basic_string
143
144 template <typename TChar, typename TCharTraits, typename TAlloc>
145 inline void const * 
146 id(::std::basic_string<TChar, TCharTraits, TAlloc> const & me)
147 {
148 SEQAN_CHECKPOINT
149         return & *end(me, Standard());
150 }
151
152 //////////////////////////////////////////////////////////////////////////////
153
154 ///.Function.begin.param.object.type:Adaption.std::basic_string
155 template <typename TChar, typename TCharTraits, typename TAlloc>
156 inline typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Standard>::Type 
157 begin(::std::basic_string<TChar, TCharTraits, TAlloc> & me,
158           Standard)
159 {
160 SEQAN_CHECKPOINT
161         return typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Standard>::Type(me.begin());
162 }
163 template <typename TChar, typename TCharTraits, typename TAlloc>
164 inline typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc> const, Standard>::Type 
165 begin(::std::basic_string<TChar, TCharTraits, TAlloc> const & me,
166           Standard)
167 {
168 SEQAN_CHECKPOINT
169         return typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc> const, Standard>::Type(me.begin());
170 }
171
172 //////////////////////////////////////////////////////////////////////////////
173
174 ///.Function.end.param.object.type:Adaption.std::basic_string
175
176 template <typename TChar, typename TCharTraits, typename TAlloc>
177 inline typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Standard>::Type 
178 end(::std::basic_string<TChar, TCharTraits, TAlloc> & me,
179         Standard)
180 {
181 SEQAN_CHECKPOINT
182         return typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Standard>::Type(me.end());
183 }
184 template <typename TChar, typename TCharTraits, typename TAlloc>
185 inline typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc> const, Standard>::Type 
186 end(::std::basic_string<TChar, TCharTraits, TAlloc> const & me,
187         Standard)
188 {
189 SEQAN_CHECKPOINT
190         return typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc> const, Standard>::Type(me.end());
191 }
192
193 //////////////////////////////////////////////////////////////////////////////
194
195 ///.Function.value.param.container.type:Adaption.std::basic_string
196
197 template <typename TChar, typename TCharTraits, typename TAlloc, typename TPos>
198 inline typename GetValue< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type
199 value(::std::basic_string<TChar, TCharTraits, TAlloc> & me, 
200           TPos pos)
201 {
202 SEQAN_CHECKPOINT
203         return me[pos];
204
205 template <typename TChar, typename TCharTraits, typename TAlloc, typename TPos>
206 inline typename GetValue< ::std::basic_string<TChar, TCharTraits, TAlloc> const>::Type
207 value(::std::basic_string<TChar, TCharTraits, TAlloc> const & me, 
208           TPos pos)
209 {
210 SEQAN_CHECKPOINT
211         return me[pos];
212 }
213
214 //////////////////////////////////////////////////////////////////////////////
215
216 ///.Function.length.param.object.type:Adaption.std::basic_string
217
218 template <typename TChar, typename TCharTraits, typename TAlloc>
219 inline typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type
220 length(::std::basic_string<TChar, TCharTraits, TAlloc> const & me)
221 {
222 SEQAN_CHECKPOINT
223         return me.length();
224 }
225
226 //////////////////////////////////////////////////////////////////////////////
227
228 ///.Function.capacity.param.object.type:Adaption.std::basic_string
229
230 template <typename TChar, typename TCharTraits, typename TAlloc>
231 inline typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type
232 capacity(::std::basic_string<TChar, TCharTraits, TAlloc> const & me)
233 {
234 SEQAN_CHECKPOINT
235         return me.capacity();
236 }
237
238 //////////////////////////////////////////////////////////////////////////////
239
240 ///.Function.empty.param.object.type:Adaption.std::basic_string
241
242 template <typename TChar, typename TCharTraits, typename TAlloc>
243 inline bool
244 empty(::std::basic_string<TChar, TCharTraits, TAlloc> const & me)
245 {
246 SEQAN_CHECKPOINT
247         return me.empty();
248 }
249
250 //////////////////////////////////////////////////////////////////////////////
251
252 ///.Function.clear.param.object.type:Adaption.std::basic_string
253
254 template <typename TChar, typename TCharTraits, typename TAlloc>
255 inline void
256 clear(::std::basic_string<TChar, TCharTraits, TAlloc> & me)
257 {
258 SEQAN_CHECKPOINT
259         me.clear();
260 }
261
262 //////////////////////////////////////////////////////////////////////////////
263 //assign to ::std::basic_string
264
265 ///.Function.assign.param.target.type:Adaption.std::basic_string
266 ///.Function.assign.param.source.type:Adaption.std::basic_string
267
268 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
269 inline void 
270 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
271            TSource & source)
272 {
273 SEQAN_CHECKPOINT
274         assign(target, source, Generous());
275 }
276 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
277 inline void 
278 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
279            TSource const & source)
280 {
281 SEQAN_CHECKPOINT
282         assign(target, source, Generous());
283 }
284
285 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource, typename TSize>
286 inline void 
287 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
288            TSource & source,
289            TSize limit)
290 {
291 SEQAN_CHECKPOINT
292         assign(target, source, limit, Generous());
293 }
294 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource, typename TSize>
295 inline void 
296 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
297            TSource const & source,
298            TSize limit)
299 {
300 SEQAN_CHECKPOINT
301         assign(target, source, limit, Generous());
302 }
303
304 //____________________________________________________________________________
305
306 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
307 inline void 
308 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
309            TSource & source,
310            Generous)
311 {
312 SEQAN_CHECKPOINT
313         target.assign(begin(source, Standard()), end(source, Standard()));
314 }
315 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
316 inline void 
317 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
318            TSource const & source,
319            Generous)
320 {
321 SEQAN_CHECKPOINT
322         target.assign(begin(source, Standard()), end(source, Standard()));
323 }
324
325
326 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
327 inline void 
328 assign_std_string_Generous_impl(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
329                                                                 TSource & source,
330                                                                 typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit)
331 {
332 SEQAN_CHECKPOINT
333         typename Iterator<TSource const, Standard>::Type source_begin = begin(source, Standard());
334         typename Size<TSource const>::Type source_length = length(source);
335         if (source_length > limit)
336         {
337                 source_length = limit;
338         }
339         target.assign(source_begin, source_begin + source_length);
340 }
341 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
342 inline void 
343 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
344            TSource & source,
345            typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit,
346            Generous)
347 {
348 SEQAN_CHECKPOINT
349         assign_std_string_Generous_impl(target, source, limit);
350 }
351 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
352 inline void 
353 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
354            TSource const & source,
355            typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit,
356            Generous)
357 {
358 SEQAN_CHECKPOINT
359         assign_std_string_Generous_impl(target, source, limit);
360 }
361
362 //____________________________________________________________________________
363
364 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
365 inline void 
366 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
367            TSource & source,
368            Limit)
369 {
370 SEQAN_CHECKPOINT
371         assign(target, source, target.capacity(), Generous());
372 }
373 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
374 inline void 
375 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
376            TSource const & source,
377            Limit)
378 {
379 SEQAN_CHECKPOINT
380         assign(target, source, target.capacity(), Generous());
381 }
382
383 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
384 inline void 
385 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
386            TSource & source,
387            typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit,
388            Limit)
389 {
390 SEQAN_CHECKPOINT
391         if (limit > target.capacity()) 
392         {
393                 limit = target.capacity();
394         }
395
396         assign(target, source, limit, Generous());
397 }
398 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
399 inline void 
400 assign(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
401            TSource const & source,
402            typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit,
403            Limit)
404 {
405 SEQAN_CHECKPOINT
406         if (limit > target.capacity()) 
407         {
408                 limit = target.capacity();
409         }
410
411         assign(target, source, limit, Generous());
412 }
413
414 //////////////////////////////////////////////////////////////////////////////
415 //append to ::std::basic_string
416
417 ///.Function.append.param.target.type:Adaption.std::basic_string
418 ///.Function.append.param.source.type:Adaption.std::basic_string
419
420 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
421 inline void 
422 append(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
423            TSource const & source,
424            Generous)
425 {
426 SEQAN_CHECKPOINT
427         target.append(begin(source, Standard()), end(source, Standard()));
428 }
429
430 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
431 inline void 
432 append(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
433            TSource const & source,
434            typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit,
435            Generous)
436 {
437 SEQAN_CHECKPOINT
438         typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type target_length = target.length();
439         if (target_length > limit)
440         {
441                 target.resize(limit);
442         }
443         else
444         {
445                 limit -= target_length;
446                 typename Iterator<TSource const, Standard>::Type source_begin = begin(source, Standard());
447                 typename Size<TSource const>::Type source_length = length(source);
448                 if (source_length > limit)
449                 {
450                         source_length = limit;
451                 }
452                 target.append(source_begin, source_begin + source_length);
453         }
454 }
455
456 //____________________________________________________________________________
457
458 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
459 inline void 
460 append(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
461            TSource const & source,
462            Limit)
463 {
464 SEQAN_CHECKPOINT
465         append(target, source, target.capacity(), Generous());
466 }
467
468 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
469 inline void 
470 append(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
471            TSource const & source,
472            typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit,
473            Limit)
474 {
475 SEQAN_CHECKPOINT
476         if (limit > target.capacity()) 
477         {
478                 limit = target.capacity();
479         }
480
481         append(target, source, limit, Generous());
482 }
483
484 //////////////////////////////////////////////////////////////////////////////
485 ///.Function.appendValue.param.target.type:Adaption.std::basic_string
486
487 template <typename TChar, typename TCharTraits, typename TAlloc, typename TValue, typename TTag>
488 inline void
489 appendValue(::std::basic_string<TChar, TCharTraits, TAlloc> & me, 
490                         TValue const & _value,
491                         TTag)
492 {
493 SEQAN_CHECKPOINT
494         me.push_back(_value);
495
496
497 template <typename TChar, typename TCharTraits, typename TAlloc, typename TValue>
498 inline void
499 appendValue(::std::basic_string<TChar, TCharTraits, TAlloc> & me, 
500                         TValue const & _value,
501                         Limit)
502 {
503 SEQAN_CHECKPOINT
504         if (capacity(me) > length(me)) me.push_back(_value);
505
506
507 //////////////////////////////////////////////////////////////////////////////
508 //replace to ::std::basic_string
509
510 ///.Function.replace.param.target.type:Adaption.std::basic_string
511 ///.Function.replace.param.source.type:Adaption.std::basic_string
512
513 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
514 inline void 
515 replace(::std::basic_string<TChar, TCharTraits, TAlloc> & target,
516                 typename Position< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type pos_begin,
517                 typename Position< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type pos_end,
518                 TSource const & source,
519                 Generous)
520 {
521 SEQAN_CHECKPOINT
522         target.replace(target.begin() + pos_begin, target.begin() + pos_end, begin(source, Standard()), end(source, Standard()));
523 }
524
525 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
526 inline void 
527 replace(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
528                 typename Position< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type pos_begin,
529                 typename Position< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type pos_end,
530                 TSource const & source,
531                 typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit,
532                 Generous)
533 {
534 SEQAN_CHECKPOINT
535         if (pos_begin >= limit)
536         {
537                 target.resize(limit);
538         }
539         else
540         {
541                 typename Iterator<TSource const, Standard>::Type source_begin = begin(source, Standard());
542                 typename Size<TSource const>::Type source_length = length(source);
543                 typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type pos_mid = pos_begin + source_length;
544                 if (pos_mid > limit)
545                 {
546                         target.replace(target.begin() + pos_begin, target.begin() + limit, source_begin, source_begin + limit - pos_begin);
547                         target.resize(limit);
548                 }
549                 else
550                 {
551                         target.replace(target.begin() + pos_begin, target.begin() + pos_end, source_begin, end(source, Standard()));
552                         if (target.length() > limit)
553                         {
554                                 target.resize(limit);
555                         }
556                 }
557         }
558 }
559
560 //____________________________________________________________________________
561
562 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
563 inline void 
564 replace(::std::basic_string<TChar, TCharTraits, TAlloc> & target,
565                 typename Position< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type pos_begin,
566                 typename Position< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type pos_end,
567                 TSource const & source,
568                 Limit)
569 {
570 SEQAN_CHECKPOINT
571         replace(target, pos_begin, pos_end, source, target.capacity(), Generous());
572 }
573
574 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSource>
575 inline void 
576 replace(::std::basic_string<TChar, TCharTraits, TAlloc> & target, 
577                 typename Position< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type pos_begin,
578                 typename Position< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type pos_end,
579                 TSource const & source,
580                 typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit,
581                 Limit)
582 {
583 SEQAN_CHECKPOINT
584         if (limit > target.capacity()) 
585         {
586                 limit = target.capacity();
587         }
588
589         replace(target, pos_begin, pos_end, source, limit, Generous());
590 }
591
592 //////////////////////////////////////////////////////////////////////////////
593 // handling of iterators as begin and end
594
595 /*
596 template<typename TChar, typename TCharTraits, typename TAlloc, typename TSource, typename TExpand>
597 inline void 
598 replace(::std::basic_string<TChar, TCharTraits, TAlloc> & target,
599                 typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Rooted>::Type pos_begin,
600                 typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Rooted>::Type pos_end,
601                 TSource & source,
602                 Tag<TExpand> const tag)
603 {
604         replace(target, position(pos_begin), position(pos_end), source, tag);
605 }
606
607 template<typename TChar, typename TCharTraits, typename TAlloc, typename TSource, typename TExpand>
608 inline void 
609 replace(::std::basic_string<TChar, TCharTraits, TAlloc> & target,
610                 typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Rooted>::Type pos_begin,
611                 typename Iterator< ::std::basic_string<TChar, TCharTraits, TAlloc>, Rooted>::Type pos_end,
612                 TSource & source,
613                 typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type limit,
614                 Tag<TExpand> const tag)
615 {
616         replace(target,  position(pos_begin),  position(pos_end), source, tag);
617 }
618 */
619
620 //////////////////////////////////////////////////////////////////////////////
621
622 ///.Function.reserve.param.object.type:Adaption.std::basic_string
623
624 template <typename TChar, typename TCharTraits, typename TAlloc, typename TExpand>
625 inline typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type 
626 reserve(
627         ::std::basic_string<TChar, TCharTraits, TAlloc> & seq, 
628         typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type new_capacity,
629         Tag<TExpand> const &)
630 {
631 SEQAN_CHECKPOINT
632     seq.reserve(new_capacity);
633     if (new_capacity < seq.capacity())
634     {
635         return seq.capacity();
636     }
637         return new_capacity;
638 }
639
640 //////////////////////////////////////////////////////////////////////////////
641
642 ///.Function.resize.param.object.type:Adaption.std::basic_string
643
644 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSize, typename TExpand>
645 inline typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type 
646 resize(
647         ::std::basic_string<TChar, TCharTraits, TAlloc> & me,
648         TSize new_length,
649         Tag<TExpand> const &)
650 {
651 SEQAN_CHECKPOINT
652     me.resize(new_length);
653         return me.length();
654 }
655
656 //////////////////////////////////////////////////////////////////////////////
657
658 ///.Function.fill.param.object.type:Adaption.std::basic_string
659
660 template <typename TChar, typename TCharTraits, typename TAlloc, typename TSize, typename TExpand>
661 inline typename Size< ::std::basic_string<TChar, TCharTraits, TAlloc> >::Type 
662 fill(
663         ::std::basic_string<TChar, TCharTraits, TAlloc> & me,
664         TSize new_length,
665         TChar const & val,
666         Tag<TExpand> const &)
667 {
668 SEQAN_CHECKPOINT
669     me.resize(new_length, val);
670         return me.length();
671 }
672
673
674 /* (veraltet)
675 //////////////////////////////////////////////////////////////////////////////
676 // Iterator Handling
677 //////////////////////////////////////////////////////////////////////////////
678
679 //??????
680 template <typename TChar, typename TContainer>
681 struct GetValue< ::__gnu_cxx::__normal_iterator<TChar, TContainer> >
682 {
683         typedef typename ::__gnu_cxx::__normal_iterator<TChar, TContainer>::reference Type;
684 };
685 */
686
687 //////////////////////////////////////////////////////////////////////////////
688
689 } //namespace SEQAN_NAMESPACE_MAIN
690
691 #endif //#ifndef SEQAN_HEADER_...