diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2007-09-28 06:17:36 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2007-09-28 06:17:36 +0000 |
commit | aa3294f14e33ae5078fcdbedc9df241a674a9f2e (patch) | |
tree | e95314cdb90238b4e3558257474e32d01681e5a2 /doc/example.cpp | |
parent | 835e0c9f674554adf9621fd84b32c9cde9f2bdf6 (diff) |
add example to the documentation
Diffstat (limited to 'doc/example.cpp')
-rw-r--r-- | doc/example.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/example.cpp b/doc/example.cpp new file mode 100644 index 000000000..89f7820b1 --- /dev/null +++ b/doc/example.cpp @@ -0,0 +1,28 @@ +#include "../src/All" + +using namespace std; + +template<typename Scalar, typename Derived> +void foo(const EiObject<Scalar, Derived>& m) +{ + cout << "Here's m:" << endl << m << endl; +} + +template<typename Scalar, typename Derived> +EiScalarProduct<Derived> +twice(const EiObject<Scalar, Derived>& m) +{ + return static_cast<Scalar>(2) * m; +} + +int main(int, char**) +{ + EiMatrix2d m; + m(0,0)= 1; + m(1,0)= 2; + m(0,1)= 3; + m(1,1)= 4; + foo(m); + foo(twice(m)); + return 0; +} |