Remove incorrect cache_purge() calls in *_rmdir() (OLD API). These could
[dragonfly.git] / contrib / libstdc++3 / include / bits / valarray_array.tcc
1 // The template and inlines for the -*- C++ -*- internal _Array helper class.
2
3 // Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library.  This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
9 // any later version.
10
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING.  If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
20
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction.  Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License.  This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
29
30 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
31
32 #ifndef _CPP_BITS_VALARRAY_ARRAY_TCC 
33 #define _CPP_BITS_VALARRAY_ARRAY_TCC 1
34
35 namespace std
36 {
37
38 export template<typename _Tp>
39 void
40 __valarray_fill (_Array<_Tp> __a, size_t __n, _Array<bool> __m, const _Tp& __t)
41 {
42     _Tp* __p = __a._M_data;
43     bool* __ok (__m._M_data);
44     for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) {
45         while (! *__ok) {
46             ++__ok;
47             ++__p;
48         }
49         *__p = __t;
50     }
51 }
52
53 export template<typename _Tp>
54 void
55 __valarray_copy (_Array<_Tp> __a, _Array<bool> __m, _Array<_Tp> __b, size_t __n)
56 {
57     _Tp* __p (__a._M_data);
58     bool* __ok (__m._M_data);
59     for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++__ok, ++__p) {
60         while (! *__ok) {
61             ++__ok;
62             ++__p;
63         }
64         *__q = *__p;
65     }
66 }
67
68 export template<typename _Tp>
69 void
70 __valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, _Array<bool> __m)
71 {
72     _Tp* __q (__b._M_data);
73     bool* __ok (__m._M_data);
74     for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, ++__ok, ++__q) {
75         while (! *__ok) {
76             ++__ok;
77             ++__q;
78         }
79         *__q = *__p;
80     }
81 }
82
83 export template<typename _Tp, class _Dom>
84 void
85 __valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a)
86 {
87     _Tp* __p (__a._M_data);
88     for (size_t __i=0; __i<__n; ++__i, ++__p) *__p = __e[__i];
89 }
90
91 export template<typename _Tp, class _Dom>
92 void
93 __valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, 
94                  _Array<_Tp> __a, size_t __s)
95 {
96     _Tp* __p (__a._M_data);
97     for (size_t __i=0; __i<__n; ++__i, __p+=__s) *__p = __e[__i];
98 }
99
100 export template<typename _Tp, class _Dom>
101 void
102 __valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, 
103                  _Array<_Tp> __a, _Array<size_t> __i)
104 {
105     size_t* __j (__i._M_data);
106     for (size_t __k=0; __k<__n; ++__k, ++__j) __a._M_data[*__j] = __e[__k];
107 }
108
109 export template<typename _Tp, class _Dom>
110 void
111 __valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, 
112                  _Array<_Tp> __a, _Array<bool> __m)
113 {
114     bool* __ok (__m._M_data);
115     _Tp* __p (__a._M_data);
116     for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) {
117         while (! *__ok) {
118             ++__ok;
119             ++__p;
120         }
121         *__p = __e[__i];
122     }
123 }
124
125
126 export template<typename _Tp, class _Dom>
127 void
128 __valarray_copy_construct (const _Expr<_Dom, _Tp>& __e, size_t __n,
129                            _Array<_Tp> __a)
130 {
131     _Tp* __p (__a._M_data);
132     for (size_t __i=0; __i<__n; ++__i, ++__p) new (__p) _Tp(__e[__i]);
133 }
134
135
136 export template<typename _Tp>
137 void
138 __valarray_copy_construct (_Array<_Tp> __a, _Array<bool> __m,
139                            _Array<_Tp> __b, size_t __n)
140 {
141     _Tp* __p (__a._M_data);
142     bool* __ok (__m._M_data);
143     for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++__ok, ++__p) {
144         while (! *__ok) {
145             ++__ok;
146             ++__p;
147         }
148         new (__q) _Tp(*__p);
149     }
150 }
151
152
153
154
155 } // std::
156
157 #endif /* _CPP_BITS_VALARRAY_ARRAY_TCC */
158
159 // Local Variables:
160 // mode:c++
161 // End: