![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
いろいろなテクニック.Nucleo と DISCO-F746 用.
Dependencies: Array_Matrix mbed
PassArrayConstructor.hpp@1:bbb9f0c3e523, 2019-04-10 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Wed Apr 10 06:32:33 2019 +0000
- Revision:
- 1:bbb9f0c3e523
- Parent:
- 0:bb939e0bc6e2
2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:bb939e0bc6e2 | 1 | #define DEBUG_ARRAY_CHECK |
MikamiUitOpen | 0:bb939e0bc6e2 | 2 | #include "Array.hpp" |
MikamiUitOpen | 0:bb939e0bc6e2 | 3 | using namespace Mikami; |
MikamiUitOpen | 0:bb939e0bc6e2 | 4 | |
MikamiUitOpen | 0:bb939e0bc6e2 | 5 | class MyClassArray |
MikamiUitOpen | 0:bb939e0bc6e2 | 6 | { |
MikamiUitOpen | 0:bb939e0bc6e2 | 7 | public: |
MikamiUitOpen | 0:bb939e0bc6e2 | 8 | MyClassArray(const Array<int>& x) : x_(x) {} |
MikamiUitOpen | 0:bb939e0bc6e2 | 9 | |
MikamiUitOpen | 0:bb939e0bc6e2 | 10 | void Execute() |
MikamiUitOpen | 0:bb939e0bc6e2 | 11 | { |
MikamiUitOpen | 0:bb939e0bc6e2 | 12 | for (int n=0; n<x_.Length(); n++) |
MikamiUitOpen | 0:bb939e0bc6e2 | 13 | printf("%2d: %4d\r\n", n, x_[n]); |
MikamiUitOpen | 0:bb939e0bc6e2 | 14 | } |
MikamiUitOpen | 0:bb939e0bc6e2 | 15 | |
MikamiUitOpen | 0:bb939e0bc6e2 | 16 | private: |
MikamiUitOpen | 0:bb939e0bc6e2 | 17 | const Array<int>& x_; |
MikamiUitOpen | 0:bb939e0bc6e2 | 18 | }; |
MikamiUitOpen | 0:bb939e0bc6e2 | 19 | |
MikamiUitOpen | 0:bb939e0bc6e2 | 20 | void MyPassArrayConstructor() |
MikamiUitOpen | 0:bb939e0bc6e2 | 21 | { |
MikamiUitOpen | 0:bb939e0bc6e2 | 22 | printf("PassArrayConstructor()\r\n"); |
MikamiUitOpen | 0:bb939e0bc6e2 | 23 | Array<int> x(5); |
MikamiUitOpen | 0:bb939e0bc6e2 | 24 | for (int n=0; n<x.Length(); n++) x[n] = (n+1)*(n+1); |
MikamiUitOpen | 0:bb939e0bc6e2 | 25 | |
MikamiUitOpen | 0:bb939e0bc6e2 | 26 | MyClassArray obj(x); |
MikamiUitOpen | 0:bb939e0bc6e2 | 27 | obj.Execute(); |
MikamiUitOpen | 0:bb939e0bc6e2 | 28 | } |