1 /*$Id: l_stlextra.h,v 1.1 2009-10-23 12:01:45 felix Exp $ -*- C++ -*-
2 * Copyright (C) 2001 Albert Davis
3 * Author: Albert Davis <aldavis@gnu.org>
5 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * This program 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
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 *------------------------------------------------------------------
22 * extra functions in the STL style
23 * Things that ought to be there, but are not
25 //testing=script,complete 2006.07.13
29 /*--------------------------------------------------------------------------*/
31 /*--------------------------------------------------------------------------*/
32 template <class InputIter
, class Size
, class OutputIter
>
33 void copy_n(InputIter first
, Size count
, OutputIter result
)
35 for ( ; count
> 0; --count
) {
39 /*--------------------------------------------------------------------------*/
40 /* find_ptr: like the stl find, except that the list contains pointers
41 Dereference the pointer in the list, then compare */
42 template <class InputIterator
, class T
>
43 InputIterator
find_ptr(InputIterator first
,InputIterator last
,const T
& value
)
45 while (first
!= last
&& **first
!= value
) {
50 /*--------------------------------------------------------------------------*/
51 inline void to_lower(std::string
* s
)
54 for (std::string::iterator i
= s
->begin(); i
!= s
->end(); ++i
) {
55 *i
= static_cast<char>(tolower(*i
));
58 /*--------------------------------------------------------------------------*/
59 inline std::string
to_lower(const std::string s
)
65 /*--------------------------------------------------------------------------*/
66 inline void to_upper(std::string
* s
)
69 for (std::string::iterator i
= s
->begin(); i
!= s
->end(); ++i
) {
70 *i
= static_cast<char>(toupper(*i
));
73 /*--------------------------------------------------------------------------*/
75 /*--------------------------------------------------------------------------*/
76 /*--------------------------------------------------------------------------*/
78 // vim:ts=8:sw=2:noet: