Last change
on this file since 12706 was 12706, checked in by Mathieu Morlighem, 13 years ago |
merged trunk-jpl and trunk for revision 12703
|
File size:
676 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * recast.h
|
---|
3 | *
|
---|
4 | * Created on: Jun 26, 2012
|
---|
5 | * Author: utke
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef _RECAST_H_
|
---|
9 | #define _RECAST_H_
|
---|
10 |
|
---|
11 | #ifndef _HAVE_ADOLC_
|
---|
12 |
|
---|
13 | template<class To, class From>
|
---|
14 | To reCast(const From& from) {
|
---|
15 | return (To)from;
|
---|
16 | }
|
---|
17 |
|
---|
18 | #else
|
---|
19 |
|
---|
20 | template<class To, class From>
|
---|
21 | struct ForPartialSpecialization {
|
---|
22 | static To reCast(const From& from ) { return (To) from;}
|
---|
23 | };
|
---|
24 |
|
---|
25 | template<class To, class From>
|
---|
26 | To reCast(const From& from) {
|
---|
27 | return ForPartialSpecialization<To,From>::reCast(from);
|
---|
28 | }
|
---|
29 | /**
|
---|
30 | * partial specialization
|
---|
31 | */
|
---|
32 | template<class To>
|
---|
33 | struct ForPartialSpecialization<To,adouble> {
|
---|
34 | static To reCast(const adouble& from ) { return (To) (from.getValue());}
|
---|
35 | };
|
---|
36 |
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.