BasicMatrix.html 2.0 KB

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