File: cast.cpp

package info (click to toggle)
blitz%2B%2B 1%3A1.0.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,016 kB
  • sloc: cpp: 56,889; python: 1,939; fortran: 1,510; f90: 852; makefile: 828; sh: 309
file content (27 lines) | stat: -rw-r--r-- 373 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <blitz/array.h>

#ifdef BZ_NAMESPACES
using namespace blitz;
#endif

int main()
{
    Array<int,1> A(4), B(4);
    Array<float,1> C(4);

    A = 1, 2, 3, 5;
    B = 2, 2, 2, 7;

    C = A / B;
    cout << C << endl;

#ifdef BZ_NEW_EXPRESSION_TEMPLATES
    C = A / cast<float>(B);
#else
    C = A / cast(B, float());
#endif
    cout << C << endl;

    return 0;
}