]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <HTML> |
2 | <!-- | |
3 | Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000 | |
4 | ||
5 | Distributed under the Boost Software License, Version 1.0. | |
6 | (See accompanying file LICENSE_1_0.txt or copy at | |
7 | http://www.boost.org/LICENSE_1_0.txt) | |
8 | --> | |
9 | <Head> | |
10 | <Title>BasicMatrix</Title> | |
11 | <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" | |
12 | ALINK="#ff0000"> | |
13 | <IMG SRC="../../../boost.png" | |
14 | ALT="C++ Boost" width="277" height="86"> | |
15 | ||
16 | <BR Clear> | |
17 | ||
18 | <H1><A NAME="concept:BasicMatrix"></A> | |
19 | BasicMatrix | |
20 | </H1> | |
21 | ||
22 | The BasicMatrix concept provides a minimalist interface for | |
23 | accessing elements from a 2 dimensional table of values. | |
24 | ||
25 | ||
26 | <H3>Refinement of</H3> | |
27 | ||
28 | none | |
29 | ||
30 | <h3>Notation</h3> | |
31 | ||
32 | <Table> | |
33 | <TR> | |
34 | <TD>{<tt>M,I,V</tt>}</TD> | |
35 | <TD>The matrix, index, and values types that together model the BasicMatrix concept.</TD> | |
36 | </TR> | |
37 | ||
38 | <TR> | |
39 | <TD><tt>A</tt></TD> | |
40 | <TD>An object of type <tt>M</tt>.</TD> | |
41 | </TR> | |
42 | ||
43 | <TR> | |
44 | <TD><tt>i, j</tt></TD> | |
45 | <TD>Objects of type <tt>I</tt>.</TD> | |
46 | </TR> | |
47 | ||
48 | </table> | |
49 | ||
50 | <H3>Associated Types</H3> | |
51 | ||
52 | none | |
53 | ||
54 | <h3>Valid Expressions</h3> | |
55 | ||
56 | <Table border> | |
57 | ||
58 | <tr> | |
59 | <td><a name="sec:elt-access"><TT>A[i][j]</TT></a></TD> | |
60 | <TD>Returns a reference to the element object stored at index <tt>(i,j)</tt><br> | |
61 | Return type: <TT>V&</TT> for mutable <tt>A</tt> or <TT>const V&</TT> | |
62 | for constant <tt>A</tt>. | |
63 | </TD> | |
64 | </TR> | |
65 | ||
66 | </table> | |
67 | ||
68 | <H3>Complexity guarantees</H3> | |
69 | ||
70 | Element access is constant time. | |
71 | ||
72 | <H3>Concept Checking Class</H3> | |
73 | ||
74 | <pre> | |
75 | template <class M, class I, class V> | |
76 | struct BasicMatrixConcept | |
77 | { | |
78 | void constraints() { | |
79 | V& elt = A[i][j]; | |
80 | const_constraints(A); | |
81 | ignore_unused_variable_warning(elt); | |
82 | } | |
83 | void const_constraints(const M& A) { | |
84 | const V& elt = A[i][j]; | |
85 | ignore_unused_variable_warning(elt); | |
86 | } | |
87 | M A; | |
88 | I i, j; | |
89 | }; | |
90 | </pre> | |
91 | ||
92 | <br> | |
93 | <HR> | |
94 | <TABLE> | |
95 | <TR valign=top> | |
96 | <TD nowrap>Copyright © 2000-2001</TD><TD> | |
97 | <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>, | |
98 | Indiana University (<A | |
99 | HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>) | |
100 | </TD></TR></TABLE> | |
101 | ||
102 | </BODY> | |
103 | </HTML> |