Oh GACK! src-clean doesn't quite work that easily since cleandist rebuilds the
[unix-history] / gnu / lib / libg++ / g++-include / gen / AVec.hP
CommitLineData
e87b4ac1
PR
1// This may look like C code, but it is really -*- C++ -*-
2/*
3Copyright (C) 1988 Free Software Foundation
4 written by Doug Lea (dl@rocky.oswego.edu)
5
6This file is part of the GNU C++ Library. This library is free
7software; you can redistribute it and/or modify it under the terms of
8the GNU Library General Public License as published by the Free
9Software Foundation; either version 2 of the License, or (at your
10option) any later version. This library is distributed in the hope
11that it will be useful, but WITHOUT ANY WARRANTY; without even the
12implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU Library General Public License for more details.
14You should have received a copy of the GNU Library General Public
15License along with this library; if not, write to the Free Software
16Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17*/
18
19
20#ifndef _<T>AVec_h
21#ifdef __GNUG__
22#pragma interface
23#endif
24#define _<T>AVec_h 1
25
26#include "<T>.Vec.h"
27
28class <T>AVec : public <T>Vec
29{
30protected:
31 void check_len(int l);
32 <T>* vec();
33 <T>AVec(int l, <T>* d);
34 public:
35 <T>AVec ();
36 <T>AVec (int l);
37 <T>AVec (int l, <T&> fill_value);
38 <T>AVec (<T>AVec&);
39 ~<T>AVec ();
40
41 <T>AVec& operator = (<T>AVec& a);
42 <T>AVec& operator = (<T&> fill_value);
43
44// vector by scalar -> vector operations
45
46 friend <T>AVec operator + (<T>AVec& a, <T&> b);
47 friend <T>AVec operator - (<T>AVec& a, <T&> b);
48 friend <T>AVec operator * (<T>AVec& a, <T&> b);
49 friend <T>AVec operator / (<T>AVec& a, <T&> b);
50
51 <T>AVec& operator += (<T&> b);
52 <T>AVec& operator -= (<T&> b);
53 <T>AVec& operator *= (<T&> b);
54 <T>AVec& operator /= (<T&> b);
55
56// vector by vector -> vector operations
57
58 friend <T>AVec operator + (<T>AVec& a, <T>AVec& b);
59 friend <T>AVec operator - (<T>AVec& a, <T>AVec& b);
60 <T>AVec& operator += (<T>AVec& b);
61 <T>AVec& operator -= (<T>AVec& b);
62
63 <T>AVec operator - ();
64
65 friend <T>AVec product(<T>AVec& a, <T>AVec& b);
66 <T>AVec& product(<T>AVec& b);
67 friend <T>AVec quotient(<T>AVec& a, <T>AVec& b);
68 <T>AVec& quotient(<T>AVec& b);
69
70// vector -> scalar operations
71
72 friend <T> operator * (<T>AVec& a, <T>AVec& b);
73
74 <T> sum();
75 <T> min();
76 <T> max();
77 <T> sumsq();
78
79// indexing
80
81 int min_index();
82 int max_index();
83
84// redundant but necesssary
85 friend <T>AVec concat(<T>AVec& a, <T>AVec& b);
86 friend <T>AVec map(<T>Mapper f, <T>AVec& a);
87 friend <T>AVec merge(<T>AVec& a, <T>AVec& b, <T>Comparator f);
88 friend <T>AVec combine(<T>Combiner f, <T>AVec& a, <T>AVec& b);
89 friend <T>AVec reverse(<T>AVec& a);
90 <T>AVec at(int from = 0, int n = -1);
91};
92
93inline <T>AVec::<T>AVec() {}
94inline <T>AVec::<T>AVec(int l) :<T>Vec(l) {}
95inline <T>AVec::<T>AVec(int l, <T&> fill_value) : <T>Vec (l, fill_value) {}
96inline <T>AVec::<T>AVec(<T>AVec& v) :<T>Vec(v) {}
97inline <T>AVec::<T>AVec(int l, <T>* d) :<T>Vec(l, d) {}
98inline <T>AVec::~<T>AVec() {}
99
100
101inline <T>* <T>AVec::vec()
102{
103 return s;
104}
105
106
107inline void <T>AVec::check_len(int l)
108{
109 if (l != len)
110 error("nonconformant vectors.");
111}
112
113#endif