gccxml_gem 0.9-x86-cygwin
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +75 -0
- data/bin/gccxml.exe +0 -0
- data/bin/gccxml_cc1plus.exe +0 -0
- data/gccxml.rb +50 -0
- data/share/doc/gccxml-0.9/Copyright.txt +55 -0
- data/share/doc/gccxml-0.9/gccxml.html +168 -0
- data/share/doc/gccxml-0.9/gccxml.txt +293 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/algorithm +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/algorithm.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/bitset +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/bitset.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cctype +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cfloat +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/climits +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cmath +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/complex +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/complex.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstddef +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstdio +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstdlib +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstring +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstring.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ctime +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cwchar +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cwctype +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/deque +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/deque.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/exception +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/exception.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/fstream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/fstream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/function +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/function.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/functional +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/gccxml_typeinfo.h +146 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iomanip +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iomanip.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ios +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ios.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iosfwd +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iosfwd.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iostream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iostream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/istream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/istream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iterator +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iterator.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/limits +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/limits.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/list +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/list.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/locale +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/locale.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/map +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/map.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/memory +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/memory.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/new +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/new.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/numeric +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/numeric.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ostream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ostream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/queue +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/queue.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/codecvt +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/collate +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/ctype +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iosbase +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iotraits +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iterator +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/lochelp +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/locimpl +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/locvector +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/messages +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/money +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/numbrw +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/numeral +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwdispatch.h +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwlocale +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwstderr_macros.h +64 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/string_ref +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/time +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/traits +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/tree +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/usefacet +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/valimp +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/vendor +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/set +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/set.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/sstream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/sstream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/stack +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/stack.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/stdexcept +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/stdexcept.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/streambuf +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/streambuf.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/string +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/string.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/strstream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/strstream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/typeinfo +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/typeinfo.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/utility +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/utility.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/valarray +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/valarray.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/vector +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/vector.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/except.h +154 -0
- data/share/gccxml-0.9/Borland/5.5/gccxml_fstream.h +431 -0
- data/share/gccxml-0.9/Borland/5.5/gccxml_new.h +166 -0
- data/share/gccxml-0.9/Borland/5.5/gccxml_valarray.h +786 -0
- data/share/gccxml-0.9/Borland/5.5/gccxml_vector.h +1457 -0
- data/share/gccxml-0.9/Borland/5.5/io.h +352 -0
- data/share/gccxml-0.9/Borland/5.5/oaidl.h +7006 -0
- data/share/gccxml-0.9/Borland/5.5/propidl.h +1477 -0
- data/share/gccxml-0.9/Borland/5.5/rw/locimpl.h +477 -0
- data/share/gccxml-0.9/Borland/5.5/rw/rwlocale.h +619 -0
- data/share/gccxml-0.9/Borland/5.5/stdarg.h +55 -0
- data/share/gccxml-0.9/Borland/5.5/valarray.cc +2883 -0
- data/share/gccxml-0.9/GCC/2.95/algorithm +76 -0
- data/share/gccxml-0.9/GCC/2.95/bitset +17 -0
- data/share/gccxml-0.9/GCC/2.95/cctype +24 -0
- data/share/gccxml-0.9/GCC/2.95/clocale +14 -0
- data/share/gccxml-0.9/GCC/2.95/cmath +33 -0
- data/share/gccxml-0.9/GCC/2.95/complex +38 -0
- data/share/gccxml-0.9/GCC/2.95/csetjmp +13 -0
- data/share/gccxml-0.9/GCC/2.95/csignal +14 -0
- data/share/gccxml-0.9/GCC/2.95/cstdarg +12 -0
- data/share/gccxml-0.9/GCC/2.95/cstddef +13 -0
- data/share/gccxml-0.9/GCC/2.95/cstdio +55 -0
- data/share/gccxml-0.9/GCC/2.95/cstdlib +66 -0
- data/share/gccxml-0.9/GCC/2.95/cstring +34 -0
- data/share/gccxml-0.9/GCC/2.95/ctime +24 -0
- data/share/gccxml-0.9/GCC/2.95/cwchar +65 -0
- data/share/gccxml-0.9/GCC/2.95/cwctype +31 -0
- data/share/gccxml-0.9/GCC/2.95/deque +19 -0
- data/share/gccxml-0.9/GCC/2.95/exception +20 -0
- data/share/gccxml-0.9/GCC/2.95/fstream +23 -0
- data/share/gccxml-0.9/GCC/2.95/functional +64 -0
- data/share/gccxml-0.9/GCC/2.95/gccxml_bitset +1066 -0
- data/share/gccxml-0.9/GCC/2.95/iomanip +20 -0
- data/share/gccxml-0.9/GCC/2.95/iosfwd +20 -0
- data/share/gccxml-0.9/GCC/2.95/iostream +27 -0
- data/share/gccxml-0.9/GCC/2.95/iterator +39 -0
- data/share/gccxml-0.9/GCC/2.95/list +19 -0
- data/share/gccxml-0.9/GCC/2.95/map +20 -0
- data/share/gccxml-0.9/GCC/2.95/memory +21 -0
- data/share/gccxml-0.9/GCC/2.95/new +13 -0
- data/share/gccxml-0.9/GCC/2.95/numeric +15 -0
- data/share/gccxml-0.9/GCC/2.95/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/2.95/queue +20 -0
- data/share/gccxml-0.9/GCC/2.95/set +20 -0
- data/share/gccxml-0.9/GCC/2.95/sstream +24 -0
- data/share/gccxml-0.9/GCC/2.95/stack +19 -0
- data/share/gccxml-0.9/GCC/2.95/std/bastring.cc +524 -0
- data/share/gccxml-0.9/GCC/2.95/std/complext.h +397 -0
- data/share/gccxml-0.9/GCC/2.95/std/dcomplex.h +92 -0
- data/share/gccxml-0.9/GCC/2.95/std/fcomplex.h +88 -0
- data/share/gccxml-0.9/GCC/2.95/std/gslice_array.h +170 -0
- data/share/gccxml-0.9/GCC/2.95/std/indirect_array.h +157 -0
- data/share/gccxml-0.9/GCC/2.95/std/ldcomplex.h +96 -0
- data/share/gccxml-0.9/GCC/2.95/std/mask_array.h +154 -0
- data/share/gccxml-0.9/GCC/2.95/std/slice_array.h +156 -0
- data/share/gccxml-0.9/GCC/2.95/std/std_valarray.h +728 -0
- data/share/gccxml-0.9/GCC/2.95/std/straits.h +162 -0
- data/share/gccxml-0.9/GCC/2.95/std/valarray_meta.h +1035 -0
- data/share/gccxml-0.9/GCC/2.95/stdexcept +17 -0
- data/share/gccxml-0.9/GCC/2.95/stl_alloc.h +1057 -0
- data/share/gccxml-0.9/GCC/2.95/stl_bvector.h +836 -0
- data/share/gccxml-0.9/GCC/2.95/stl_deque.h +1699 -0
- data/share/gccxml-0.9/GCC/2.95/stl_list.h +843 -0
- data/share/gccxml-0.9/GCC/2.95/stl_tree.h +1331 -0
- data/share/gccxml-0.9/GCC/2.95/stl_vector.h +828 -0
- data/share/gccxml-0.9/GCC/2.95/string +26 -0
- data/share/gccxml-0.9/GCC/2.95/strstream +23 -0
- data/share/gccxml-0.9/GCC/2.95/typeinfo +11 -0
- data/share/gccxml-0.9/GCC/2.95/utility +25 -0
- data/share/gccxml-0.9/GCC/2.95/valarray +52 -0
- data/share/gccxml-0.9/GCC/2.95/vector +19 -0
- data/share/gccxml-0.9/GCC/2.96/sstream +305 -0
- data/share/gccxml-0.9/GCC/3.0/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.1/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.2/bits/fstream.tcc +500 -0
- data/share/gccxml-0.9/GCC/3.2/bits/istream.tcc +1207 -0
- data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.h +1810 -0
- data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.tcc +2397 -0
- data/share/gccxml-0.9/GCC/3.2/bits/messages_members.h +108 -0
- data/share/gccxml-0.9/GCC/3.2/bits/ostream.tcc +713 -0
- data/share/gccxml-0.9/GCC/3.2/bits/sstream.tcc +241 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_deque.h +1682 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_list.h +989 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_tree.h +1462 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_vector.h +1085 -0
- data/share/gccxml-0.9/GCC/3.2/bits/valarray_meta.h +1063 -0
- data/share/gccxml-0.9/GCC/3.2/fstream +579 -0
- data/share/gccxml-0.9/GCC/3.2/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.2/sstream +384 -0
- data/share/gccxml-0.9/GCC/3.3/bits/fstream.tcc +530 -0
- data/share/gccxml-0.9/GCC/3.3/bits/list.tcc +378 -0
- data/share/gccxml-0.9/GCC/3.3/bits/locale_facets.h +2050 -0
- data/share/gccxml-0.9/GCC/3.3/bits/messages_members.h +108 -0
- data/share/gccxml-0.9/GCC/3.3/bits/sstream.tcc +243 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_deque.h +1603 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_list.h +1167 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_tree.h +1462 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_vector.h +992 -0
- data/share/gccxml-0.9/GCC/3.3/bits/valarray_meta.h +1135 -0
- data/share/gccxml-0.9/GCC/3.3/fstream +842 -0
- data/share/gccxml-0.9/GCC/3.3/gccxml_builtins.h +22 -0
- data/share/gccxml-0.9/GCC/3.3/sstream +638 -0
- data/share/gccxml-0.9/GCC/3.4/gccxml_builtins.h +91 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_builtins.h +128 -0
- data/share/gccxml-0.9/GCC/4.1/bits/gthr-default.h +618 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/find_flags +105 -0
- data/share/gccxml-0.9/Intel/find_flags +56 -0
- data/share/gccxml-0.9/Intel/pthread.h +16 -0
- data/share/gccxml-0.9/MIPSpro/7.3/exception +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/gccxml_mpro_internals.h +21 -0
- data/share/gccxml-0.9/MIPSpro/7.3/iomanip +161 -0
- data/share/gccxml-0.9/MIPSpro/7.3/ostream +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stddef.h +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_config.h +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_locale.h +17 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_monetary.h +14 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_numeric_facets.h +13 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_threads.h +11 -0
- data/share/gccxml-0.9/MIPSpro/7.3/string +18 -0
- data/share/gccxml-0.9/MIPSpro/find_flags +137 -0
- data/share/gccxml-0.9/Sun/5.8/adaptation.patch +168 -0
- data/share/gccxml-0.9/Sun/README +8 -0
- data/share/gccxml-0.9/Sun/adapt_headers.sh +24 -0
- data/share/gccxml-0.9/Sun/find_flags +69 -0
- data/share/gccxml-0.9/gccxml_config +2 -0
- data/share/gccxml-0.9/gccxml_find_flags +93 -0
- data/share/man/man1/gccxml.1 +246 -0
- metadata +324 -0
@@ -0,0 +1,1135 @@
|
|
1
|
+
// The template and inlines for the -*- C++ -*- internal _Meta class.
|
2
|
+
|
3
|
+
// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
4
|
+
//
|
5
|
+
// This file is part of the GNU ISO C++ Library. This library is free
|
6
|
+
// software; you can redistribute it and/or modify it under the
|
7
|
+
// terms of the GNU General Public License as published by the
|
8
|
+
// Free Software Foundation; either version 2, or (at your option)
|
9
|
+
// any later version.
|
10
|
+
|
11
|
+
// This library is distributed in the hope that it will be useful,
|
12
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
// GNU General Public License for more details.
|
15
|
+
|
16
|
+
// You should have received a copy of the GNU General Public License along
|
17
|
+
// with this library; see the file COPYING. If not, write to the Free
|
18
|
+
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
19
|
+
// USA.
|
20
|
+
|
21
|
+
// As a special exception, you may use this file as part of a free software
|
22
|
+
// library without restriction. Specifically, if other files instantiate
|
23
|
+
// templates or use macros or inline functions from this file, or you compile
|
24
|
+
// this file and link it with other files to produce an executable, this
|
25
|
+
// file does not by itself cause the resulting executable to be covered by
|
26
|
+
// the GNU General Public License. This exception does not however
|
27
|
+
// invalidate any other reasons why the executable file might be covered by
|
28
|
+
// the GNU General Public License.
|
29
|
+
|
30
|
+
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
|
31
|
+
|
32
|
+
/** @file valarray_meta.h
|
33
|
+
* This is an internal header file, included by other library headers.
|
34
|
+
* You should not attempt to use it directly.
|
35
|
+
*/
|
36
|
+
|
37
|
+
#ifndef _CPP_VALARRAY_META_H
|
38
|
+
#define _CPP_VALARRAY_META_H 1
|
39
|
+
|
40
|
+
#pragma GCC system_header
|
41
|
+
|
42
|
+
namespace std
|
43
|
+
{
|
44
|
+
//
|
45
|
+
// Implementing a loosened valarray return value is tricky.
|
46
|
+
// First we need to meet 26.3.1/3: we should not add more than
|
47
|
+
// two levels of template nesting. Therefore we resort to template
|
48
|
+
// template to "flatten" loosened return value types.
|
49
|
+
// At some point we use partial specialization to remove one level
|
50
|
+
// template nesting due to _Expr<>
|
51
|
+
//
|
52
|
+
|
53
|
+
// This class is NOT defined. It doesn't need to.
|
54
|
+
template<typename _Tp1, typename _Tp2> class _Constant;
|
55
|
+
|
56
|
+
// Implementations of unary functions applied to valarray<>s.
|
57
|
+
// I use hard-coded object functions here instead of a generic
|
58
|
+
// approach like pointers to function:
|
59
|
+
// 1) correctness: some functions take references, others values.
|
60
|
+
// we can't deduce the correct type afterwards.
|
61
|
+
// 2) efficiency -- object functions can be easily inlined
|
62
|
+
// 3) be Koenig-lookup-friendly
|
63
|
+
|
64
|
+
struct __abs
|
65
|
+
{
|
66
|
+
template<typename _Tp>
|
67
|
+
_Tp operator()(const _Tp& __t) const { return abs(__t); }
|
68
|
+
};
|
69
|
+
|
70
|
+
struct __cos
|
71
|
+
{
|
72
|
+
template<typename _Tp>
|
73
|
+
_Tp operator()(const _Tp& __t) const { return cos(__t); }
|
74
|
+
};
|
75
|
+
|
76
|
+
struct __acos
|
77
|
+
{
|
78
|
+
template<typename _Tp>
|
79
|
+
_Tp operator()(const _Tp& __t) const { return acos(__t); }
|
80
|
+
};
|
81
|
+
|
82
|
+
struct __cosh
|
83
|
+
{
|
84
|
+
template<typename _Tp>
|
85
|
+
_Tp operator()(const _Tp& __t) const { return cosh(__t); }
|
86
|
+
};
|
87
|
+
|
88
|
+
struct __sin
|
89
|
+
{
|
90
|
+
template<typename _Tp>
|
91
|
+
_Tp operator()(const _Tp& __t) const { return sin(__t); }
|
92
|
+
};
|
93
|
+
|
94
|
+
struct __asin
|
95
|
+
{
|
96
|
+
template<typename _Tp>
|
97
|
+
_Tp operator()(const _Tp& __t) const { return asin(__t); }
|
98
|
+
};
|
99
|
+
|
100
|
+
struct __sinh
|
101
|
+
{
|
102
|
+
template<typename _Tp>
|
103
|
+
_Tp operator()(const _Tp& __t) const { return sinh(__t); }
|
104
|
+
};
|
105
|
+
|
106
|
+
struct __tan
|
107
|
+
{
|
108
|
+
template<typename _Tp>
|
109
|
+
_Tp operator()(const _Tp& __t) const { return tan(__t); }
|
110
|
+
};
|
111
|
+
|
112
|
+
struct __atan
|
113
|
+
{
|
114
|
+
template<typename _Tp>
|
115
|
+
_Tp operator()(const _Tp& __t) const { return atan(__t); }
|
116
|
+
};
|
117
|
+
|
118
|
+
struct __tanh
|
119
|
+
{
|
120
|
+
template<typename _Tp>
|
121
|
+
_Tp operator()(const _Tp& __t) const { return tanh(__t); }
|
122
|
+
};
|
123
|
+
|
124
|
+
struct __exp
|
125
|
+
{
|
126
|
+
template<typename _Tp>
|
127
|
+
_Tp operator()(const _Tp& __t) const { return exp(__t); }
|
128
|
+
};
|
129
|
+
|
130
|
+
struct __log
|
131
|
+
{
|
132
|
+
template<typename _Tp>
|
133
|
+
_Tp operator()(const _Tp& __t) const { return log(__t); }
|
134
|
+
};
|
135
|
+
|
136
|
+
struct __log10
|
137
|
+
{
|
138
|
+
template<typename _Tp>
|
139
|
+
_Tp operator()(const _Tp& __t) const { return log10(__t); }
|
140
|
+
};
|
141
|
+
|
142
|
+
struct __sqrt
|
143
|
+
{
|
144
|
+
template<typename _Tp>
|
145
|
+
_Tp operator()(const _Tp& __t) const { return sqrt(__t); }
|
146
|
+
};
|
147
|
+
|
148
|
+
// In the past, we used to tailor operator applications semantics
|
149
|
+
// to the specialization of standard function objects (i.e. plus<>, etc.)
|
150
|
+
// That is incorrect. Therefore we provide our own surrogates.
|
151
|
+
|
152
|
+
struct __unary_plus
|
153
|
+
{
|
154
|
+
template<typename _Tp>
|
155
|
+
_Tp operator()(const _Tp& __t) const { return +__t; }
|
156
|
+
};
|
157
|
+
|
158
|
+
struct __negate
|
159
|
+
{
|
160
|
+
template<typename _Tp>
|
161
|
+
_Tp operator()(const _Tp& __t) const { return -__t; }
|
162
|
+
};
|
163
|
+
|
164
|
+
struct __bitwise_not
|
165
|
+
{
|
166
|
+
template<typename _Tp>
|
167
|
+
_Tp operator()(const _Tp& __t) const { return ~__t; }
|
168
|
+
};
|
169
|
+
|
170
|
+
struct __plus
|
171
|
+
{
|
172
|
+
template<typename _Tp>
|
173
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
174
|
+
{ return __x + __y; }
|
175
|
+
};
|
176
|
+
|
177
|
+
struct __minus
|
178
|
+
{
|
179
|
+
template<typename _Tp>
|
180
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
181
|
+
{ return __x - __y; }
|
182
|
+
};
|
183
|
+
|
184
|
+
struct __multiplies
|
185
|
+
{
|
186
|
+
template<typename _Tp>
|
187
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
188
|
+
{ return __x * __y; }
|
189
|
+
};
|
190
|
+
|
191
|
+
struct __divides
|
192
|
+
{
|
193
|
+
template<typename _Tp>
|
194
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
195
|
+
{ return __x / __y; }
|
196
|
+
};
|
197
|
+
|
198
|
+
struct __modulus
|
199
|
+
{
|
200
|
+
template<typename _Tp>
|
201
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
202
|
+
{ return __x % __y; }
|
203
|
+
};
|
204
|
+
|
205
|
+
struct __bitwise_xor
|
206
|
+
{
|
207
|
+
template<typename _Tp>
|
208
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
209
|
+
{ return __x ^ __y; }
|
210
|
+
};
|
211
|
+
|
212
|
+
struct __bitwise_and
|
213
|
+
{
|
214
|
+
template<typename _Tp>
|
215
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
216
|
+
{ return __x & __y; }
|
217
|
+
};
|
218
|
+
|
219
|
+
struct __bitwise_or
|
220
|
+
{
|
221
|
+
template<typename _Tp>
|
222
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
223
|
+
{ return __x | __y; }
|
224
|
+
};
|
225
|
+
|
226
|
+
struct __shift_left
|
227
|
+
{
|
228
|
+
template<typename _Tp>
|
229
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
230
|
+
{ return __x << __y; }
|
231
|
+
};
|
232
|
+
|
233
|
+
struct __shift_right
|
234
|
+
{
|
235
|
+
template<typename _Tp>
|
236
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
237
|
+
{ return __x >> __y; }
|
238
|
+
};
|
239
|
+
|
240
|
+
struct __logical_and
|
241
|
+
{
|
242
|
+
template<typename _Tp>
|
243
|
+
bool operator()(const _Tp& __x, const _Tp& __y) const
|
244
|
+
{ return __x && __y; }
|
245
|
+
};
|
246
|
+
|
247
|
+
struct __logical_or
|
248
|
+
{
|
249
|
+
template<typename _Tp>
|
250
|
+
bool operator()(const _Tp& __x, const _Tp& __y) const
|
251
|
+
{ return __x || __y; }
|
252
|
+
};
|
253
|
+
|
254
|
+
struct __logical_not
|
255
|
+
{
|
256
|
+
template<typename _Tp>
|
257
|
+
bool operator()(const _Tp& __x) const { return !__x; }
|
258
|
+
};
|
259
|
+
|
260
|
+
struct __equal_to
|
261
|
+
{
|
262
|
+
template<typename _Tp>
|
263
|
+
bool operator()(const _Tp& __x, const _Tp& __y) const
|
264
|
+
{ return __x == __y; }
|
265
|
+
};
|
266
|
+
|
267
|
+
struct __not_equal_to
|
268
|
+
{
|
269
|
+
template<typename _Tp>
|
270
|
+
bool operator()(const _Tp& __x, const _Tp& __y) const
|
271
|
+
{ return __x != __y; }
|
272
|
+
};
|
273
|
+
|
274
|
+
struct __less
|
275
|
+
{
|
276
|
+
template<typename _Tp>
|
277
|
+
bool operator()(const _Tp& __x, const _Tp& __y) const
|
278
|
+
{ return __x < __y; }
|
279
|
+
};
|
280
|
+
|
281
|
+
struct __greater
|
282
|
+
{
|
283
|
+
template<typename _Tp>
|
284
|
+
bool operator()(const _Tp& __x, const _Tp& __y) const
|
285
|
+
{ return __x > __y; }
|
286
|
+
};
|
287
|
+
|
288
|
+
struct __less_equal
|
289
|
+
{
|
290
|
+
template<typename _Tp>
|
291
|
+
bool operator()(const _Tp& __x, const _Tp& __y) const
|
292
|
+
{ return __x <= __y; }
|
293
|
+
};
|
294
|
+
|
295
|
+
struct __greater_equal
|
296
|
+
{
|
297
|
+
template<typename _Tp>
|
298
|
+
bool operator()(const _Tp& __x, const _Tp& __y) const
|
299
|
+
{ return __x >= __y; }
|
300
|
+
};
|
301
|
+
|
302
|
+
// The few binary functions we miss.
|
303
|
+
struct __atan2
|
304
|
+
{
|
305
|
+
template<typename _Tp>
|
306
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
307
|
+
{ return atan2(__x, __y); }
|
308
|
+
};
|
309
|
+
|
310
|
+
struct __pow
|
311
|
+
{
|
312
|
+
template<typename _Tp>
|
313
|
+
_Tp operator()(const _Tp& __x, const _Tp& __y) const
|
314
|
+
{ return pow(__x, __y); }
|
315
|
+
};
|
316
|
+
|
317
|
+
|
318
|
+
// We need these bits in order to recover the return type of
|
319
|
+
// some functions/operators now that we're no longer using
|
320
|
+
// function templates.
|
321
|
+
template<typename, typename _Tp>
|
322
|
+
struct __fun
|
323
|
+
{
|
324
|
+
typedef _Tp result_type;
|
325
|
+
};
|
326
|
+
|
327
|
+
// several specializations for relational operators.
|
328
|
+
template<typename _Tp>
|
329
|
+
struct __fun<__logical_not, _Tp>
|
330
|
+
{
|
331
|
+
typedef bool result_type;
|
332
|
+
};
|
333
|
+
|
334
|
+
template<typename _Tp>
|
335
|
+
struct __fun<__logical_and, _Tp>
|
336
|
+
{
|
337
|
+
typedef bool result_type;
|
338
|
+
};
|
339
|
+
|
340
|
+
template<typename _Tp>
|
341
|
+
struct __fun<__logical_or, _Tp>
|
342
|
+
{
|
343
|
+
typedef bool result_type;
|
344
|
+
};
|
345
|
+
|
346
|
+
template<typename _Tp>
|
347
|
+
struct __fun<__less, _Tp>
|
348
|
+
{
|
349
|
+
typedef bool result_type;
|
350
|
+
};
|
351
|
+
|
352
|
+
template<typename _Tp>
|
353
|
+
struct __fun<__greater, _Tp>
|
354
|
+
{
|
355
|
+
typedef bool result_type;
|
356
|
+
};
|
357
|
+
|
358
|
+
template<typename _Tp>
|
359
|
+
struct __fun<__less_equal, _Tp>
|
360
|
+
{
|
361
|
+
typedef bool result_type;
|
362
|
+
};
|
363
|
+
|
364
|
+
template<typename _Tp>
|
365
|
+
struct __fun<__greater_equal, _Tp>
|
366
|
+
{
|
367
|
+
typedef bool result_type;
|
368
|
+
};
|
369
|
+
|
370
|
+
template<typename _Tp>
|
371
|
+
struct __fun<__equal_to, _Tp>
|
372
|
+
{
|
373
|
+
typedef bool result_type;
|
374
|
+
};
|
375
|
+
|
376
|
+
template<typename _Tp>
|
377
|
+
struct __fun<__not_equal_to, _Tp>
|
378
|
+
{
|
379
|
+
typedef bool result_type;
|
380
|
+
};
|
381
|
+
|
382
|
+
//
|
383
|
+
// Apply function taking a value/const reference closure
|
384
|
+
//
|
385
|
+
|
386
|
+
template<typename _Dom, typename _Arg>
|
387
|
+
class _FunBase
|
388
|
+
{
|
389
|
+
public:
|
390
|
+
typedef typename _Dom::value_type value_type;
|
391
|
+
|
392
|
+
_FunBase(const _Dom& __e, value_type __f(_Arg))
|
393
|
+
: _M_expr(__e), _M_func(__f) {}
|
394
|
+
|
395
|
+
value_type operator[](size_t __i) const
|
396
|
+
{ return _M_func (_M_expr[__i]); }
|
397
|
+
|
398
|
+
size_t size() const { return _M_expr.size ();}
|
399
|
+
|
400
|
+
private:
|
401
|
+
const _Dom& _M_expr;
|
402
|
+
value_type (*_M_func)(_Arg);
|
403
|
+
};
|
404
|
+
|
405
|
+
template<class _Dom>
|
406
|
+
struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type>
|
407
|
+
{
|
408
|
+
typedef _FunBase<_Dom, typename _Dom::value_type> _Base;
|
409
|
+
typedef typename _Base::value_type value_type;
|
410
|
+
typedef value_type _Tp;
|
411
|
+
|
412
|
+
_ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {}
|
413
|
+
};
|
414
|
+
|
415
|
+
template<typename _Tp>
|
416
|
+
struct _ValFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, _Tp>
|
417
|
+
{
|
418
|
+
typedef _FunBase<valarray<_Tp>, _Tp> _Base;
|
419
|
+
typedef _Tp value_type;
|
420
|
+
|
421
|
+
_ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {}
|
422
|
+
};
|
423
|
+
|
424
|
+
template<class _Dom>
|
425
|
+
struct _RefFunClos<_Expr,_Dom> :
|
426
|
+
_FunBase<_Dom, const typename _Dom::value_type&>
|
427
|
+
{
|
428
|
+
typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base;
|
429
|
+
typedef typename _Base::value_type value_type;
|
430
|
+
typedef value_type _Tp;
|
431
|
+
|
432
|
+
_RefFunClos(const _Dom& __e, _Tp __f(const _Tp&))
|
433
|
+
: _Base(__e, __f) {}
|
434
|
+
};
|
435
|
+
|
436
|
+
template<typename _Tp>
|
437
|
+
struct _RefFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, const _Tp&>
|
438
|
+
{
|
439
|
+
typedef _FunBase<valarray<_Tp>, const _Tp&> _Base;
|
440
|
+
typedef _Tp value_type;
|
441
|
+
|
442
|
+
_RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&))
|
443
|
+
: _Base(__v, __f) {}
|
444
|
+
};
|
445
|
+
|
446
|
+
//
|
447
|
+
// Unary expression closure.
|
448
|
+
//
|
449
|
+
|
450
|
+
template<class _Oper, class _Arg>
|
451
|
+
class _UnBase
|
452
|
+
{
|
453
|
+
public:
|
454
|
+
typedef typename _Arg::value_type _Vt;
|
455
|
+
typedef typename __fun<_Oper, _Vt>::result_type value_type;
|
456
|
+
|
457
|
+
_UnBase(const _Arg& __e) : _M_expr(__e) {}
|
458
|
+
|
459
|
+
value_type operator[](size_t __i) const
|
460
|
+
{ return _Oper()(_M_expr[__i]); }
|
461
|
+
|
462
|
+
size_t size() const { return _M_expr.size(); }
|
463
|
+
|
464
|
+
private:
|
465
|
+
const _Arg& _M_expr;
|
466
|
+
};
|
467
|
+
|
468
|
+
template<class _Oper, class _Dom>
|
469
|
+
struct _UnClos<_Oper, _Expr, _Dom> : _UnBase<_Oper, _Dom>
|
470
|
+
{
|
471
|
+
typedef _Dom _Arg;
|
472
|
+
typedef _UnBase<_Oper, _Dom> _Base;
|
473
|
+
typedef typename _Base::value_type value_type;
|
474
|
+
|
475
|
+
_UnClos(const _Arg& __e) : _Base(__e) {}
|
476
|
+
};
|
477
|
+
|
478
|
+
template<class _Oper, typename _Tp>
|
479
|
+
struct _UnClos<_Oper, _ValArray, _Tp> : _UnBase<_Oper, valarray<_Tp> >
|
480
|
+
{
|
481
|
+
typedef valarray<_Tp> _Arg;
|
482
|
+
typedef _UnBase<_Oper, valarray<_Tp> > _Base;
|
483
|
+
typedef typename _Base::value_type value_type;
|
484
|
+
|
485
|
+
_UnClos(const _Arg& __e) : _Base(__e) {}
|
486
|
+
};
|
487
|
+
|
488
|
+
|
489
|
+
//
|
490
|
+
// Binary expression closure.
|
491
|
+
//
|
492
|
+
|
493
|
+
template<class _Oper, class _FirstArg, class _SecondArg>
|
494
|
+
class _BinBase
|
495
|
+
{
|
496
|
+
public:
|
497
|
+
typedef typename _FirstArg::value_type _Vt;
|
498
|
+
typedef typename __fun<_Oper, _Vt>::result_type value_type;
|
499
|
+
|
500
|
+
_BinBase(const _FirstArg& __e1, const _SecondArg& __e2)
|
501
|
+
: _M_expr1(__e1), _M_expr2(__e2) {}
|
502
|
+
|
503
|
+
value_type operator[](size_t __i) const
|
504
|
+
{ return _Oper()(_M_expr1[__i], _M_expr2[__i]); }
|
505
|
+
|
506
|
+
size_t size() const { return _M_expr1.size(); }
|
507
|
+
|
508
|
+
private:
|
509
|
+
const _FirstArg& _M_expr1;
|
510
|
+
const _SecondArg& _M_expr2;
|
511
|
+
};
|
512
|
+
|
513
|
+
|
514
|
+
template<class _Oper, class _Clos>
|
515
|
+
class _BinBase2
|
516
|
+
{
|
517
|
+
public:
|
518
|
+
typedef typename _Clos::value_type _Vt;
|
519
|
+
typedef typename __fun<_Oper, _Vt>::result_type value_type;
|
520
|
+
|
521
|
+
_BinBase2(const _Clos& __e, const _Vt& __t)
|
522
|
+
: _M_expr1(__e), _M_expr2(__t) {}
|
523
|
+
|
524
|
+
value_type operator[](size_t __i) const
|
525
|
+
{ return _Oper()(_M_expr1[__i], _M_expr2); }
|
526
|
+
|
527
|
+
size_t size() const { return _M_expr1.size(); }
|
528
|
+
|
529
|
+
private:
|
530
|
+
const _Clos& _M_expr1;
|
531
|
+
const _Vt& _M_expr2;
|
532
|
+
};
|
533
|
+
|
534
|
+
template<class _Oper, class _Clos>
|
535
|
+
class _BinBase1
|
536
|
+
{
|
537
|
+
public:
|
538
|
+
typedef typename _Clos::value_type _Vt;
|
539
|
+
typedef typename __fun<_Oper, _Vt>::result_type value_type;
|
540
|
+
|
541
|
+
_BinBase1(const _Vt& __t, const _Clos& __e)
|
542
|
+
: _M_expr1(__t), _M_expr2(__e) {}
|
543
|
+
|
544
|
+
value_type operator[](size_t __i) const
|
545
|
+
{ return _Oper()(_M_expr1, _M_expr2[__i]); }
|
546
|
+
|
547
|
+
size_t size() const { return _M_expr2.size(); }
|
548
|
+
|
549
|
+
private:
|
550
|
+
const _Vt& _M_expr1;
|
551
|
+
const _Clos& _M_expr2;
|
552
|
+
};
|
553
|
+
|
554
|
+
template<class _Oper, class _Dom1, class _Dom2>
|
555
|
+
struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2>
|
556
|
+
: _BinBase<_Oper,_Dom1,_Dom2>
|
557
|
+
{
|
558
|
+
typedef _BinBase<_Oper,_Dom1,_Dom2> _Base;
|
559
|
+
typedef typename _Base::value_type value_type;
|
560
|
+
|
561
|
+
_BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {}
|
562
|
+
};
|
563
|
+
|
564
|
+
template<class _Oper, typename _Tp>
|
565
|
+
struct _BinClos<_Oper,_ValArray,_ValArray,_Tp,_Tp>
|
566
|
+
: _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> >
|
567
|
+
{
|
568
|
+
typedef _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > _Base;
|
569
|
+
typedef _Tp value_type;
|
570
|
+
|
571
|
+
_BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w)
|
572
|
+
: _Base(__v, __w) {}
|
573
|
+
};
|
574
|
+
|
575
|
+
template<class _Oper, class _Dom>
|
576
|
+
struct _BinClos<_Oper,_Expr,_ValArray,_Dom,typename _Dom::value_type>
|
577
|
+
: _BinBase<_Oper,_Dom,valarray<typename _Dom::value_type> >
|
578
|
+
{
|
579
|
+
typedef typename _Dom::value_type _Tp;
|
580
|
+
typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base;
|
581
|
+
typedef typename _Base::value_type value_type;
|
582
|
+
|
583
|
+
_BinClos(const _Dom& __e1, const valarray<_Tp>& __e2)
|
584
|
+
: _Base(__e1, __e2) {}
|
585
|
+
};
|
586
|
+
|
587
|
+
template<class _Oper, class _Dom>
|
588
|
+
struct _BinClos<_Oper,_ValArray,_Expr,typename _Dom::value_type,_Dom>
|
589
|
+
: _BinBase<_Oper,valarray<typename _Dom::value_type>,_Dom>
|
590
|
+
{
|
591
|
+
typedef typename _Dom::value_type _Tp;
|
592
|
+
typedef _BinBase<_Oper,valarray<_Tp>,_Dom> _Base;
|
593
|
+
typedef typename _Base::value_type value_type;
|
594
|
+
|
595
|
+
_BinClos(const valarray<_Tp>& __e1, const _Dom& __e2)
|
596
|
+
: _Base(__e1, __e2) {}
|
597
|
+
};
|
598
|
+
|
599
|
+
template<class _Oper, class _Dom>
|
600
|
+
struct _BinClos<_Oper,_Expr,_Constant,_Dom,typename _Dom::value_type>
|
601
|
+
: _BinBase2<_Oper,_Dom>
|
602
|
+
{
|
603
|
+
typedef typename _Dom::value_type _Tp;
|
604
|
+
typedef _BinBase2<_Oper,_Dom> _Base;
|
605
|
+
typedef typename _Base::value_type value_type;
|
606
|
+
|
607
|
+
_BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {}
|
608
|
+
};
|
609
|
+
|
610
|
+
template<class _Oper, class _Dom>
|
611
|
+
struct _BinClos<_Oper,_Constant,_Expr,typename _Dom::value_type,_Dom>
|
612
|
+
: _BinBase1<_Oper,_Dom>
|
613
|
+
{
|
614
|
+
typedef typename _Dom::value_type _Tp;
|
615
|
+
typedef _BinBase1<_Oper,_Dom> _Base;
|
616
|
+
typedef typename _Base::value_type value_type;
|
617
|
+
|
618
|
+
_BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {}
|
619
|
+
};
|
620
|
+
|
621
|
+
template<class _Oper, typename _Tp>
|
622
|
+
struct _BinClos<_Oper,_ValArray,_Constant,_Tp,_Tp>
|
623
|
+
: _BinBase2<_Oper,valarray<_Tp> >
|
624
|
+
{
|
625
|
+
typedef _BinBase2<_Oper,valarray<_Tp> > _Base;
|
626
|
+
typedef typename _Base::value_type value_type;
|
627
|
+
|
628
|
+
_BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {}
|
629
|
+
};
|
630
|
+
|
631
|
+
template<class _Oper, typename _Tp>
|
632
|
+
struct _BinClos<_Oper,_Constant,_ValArray,_Tp,_Tp>
|
633
|
+
: _BinBase1<_Oper,valarray<_Tp> >
|
634
|
+
{
|
635
|
+
typedef _BinBase1<_Oper,valarray<_Tp> > _Base;
|
636
|
+
typedef typename _Base::value_type value_type;
|
637
|
+
|
638
|
+
_BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {}
|
639
|
+
};
|
640
|
+
|
641
|
+
|
642
|
+
//
|
643
|
+
// slice_array closure.
|
644
|
+
//
|
645
|
+
template<typename _Dom> class _SBase {
|
646
|
+
public:
|
647
|
+
typedef typename _Dom::value_type value_type;
|
648
|
+
|
649
|
+
_SBase (const _Dom& __e, const slice& __s)
|
650
|
+
: _M_expr (__e), _M_slice (__s) {}
|
651
|
+
value_type operator[] (size_t __i) const;
|
652
|
+
size_t size() const;
|
653
|
+
|
654
|
+
private:
|
655
|
+
const _Dom& _M_expr;
|
656
|
+
const slice& _M_slice;
|
657
|
+
};
|
658
|
+
|
659
|
+
template<typename _Tp> class _SBase<_Array<_Tp> > {
|
660
|
+
public:
|
661
|
+
typedef _Tp value_type;
|
662
|
+
|
663
|
+
_SBase (_Array<_Tp> __a, const slice& __s);
|
664
|
+
value_type operator[] (size_t __i) const;
|
665
|
+
size_t size() const { return _M_size; }
|
666
|
+
|
667
|
+
private:
|
668
|
+
const _Array<_Tp> _M_array;
|
669
|
+
const size_t _M_size;
|
670
|
+
const size_t _M_stride;
|
671
|
+
};
|
672
|
+
|
673
|
+
template<class _Dom> struct _SClos<_Expr,_Dom> : _SBase<_Dom> {
|
674
|
+
typedef _SBase<_Dom> _Base;
|
675
|
+
typedef typename _Base::value_type value_type;
|
676
|
+
|
677
|
+
_SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {}
|
678
|
+
};
|
679
|
+
|
680
|
+
template<typename _Tp>
|
681
|
+
struct _SClos<_ValArray,_Tp> : _SBase<_Array<_Tp> > {
|
682
|
+
typedef _SBase<_Array<_Tp> > _Base;
|
683
|
+
typedef _Tp value_type;
|
684
|
+
|
685
|
+
_SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {}
|
686
|
+
};
|
687
|
+
|
688
|
+
//
|
689
|
+
// gslice_array closure.
|
690
|
+
//
|
691
|
+
template<class _Dom> class _GBase {
|
692
|
+
public:
|
693
|
+
typedef typename _Dom::value_type value_type;
|
694
|
+
|
695
|
+
_GBase (const _Dom& __e, const valarray<size_t>& __i)
|
696
|
+
: _M_expr (__e), _M_index(__i) {}
|
697
|
+
value_type operator[] (size_t __i) const;
|
698
|
+
size_t size () const;
|
699
|
+
|
700
|
+
private:
|
701
|
+
const _Dom& _M_expr;
|
702
|
+
const valarray<size_t>& _M_index;
|
703
|
+
};
|
704
|
+
|
705
|
+
template<typename _Tp> class _GBase<_Array<_Tp> > {
|
706
|
+
public:
|
707
|
+
typedef _Tp value_type;
|
708
|
+
|
709
|
+
_GBase (_Array<_Tp> __a, const valarray<size_t>& __i)
|
710
|
+
: _M_array (__a), _M_index(__i) {}
|
711
|
+
value_type operator[] (size_t __i) const;
|
712
|
+
size_t size () const;
|
713
|
+
|
714
|
+
private:
|
715
|
+
const _Array<_Tp> _M_array;
|
716
|
+
const valarray<size_t>& _M_index;
|
717
|
+
};
|
718
|
+
|
719
|
+
template<class _Dom> struct _GClos<_Expr,_Dom> : _GBase<_Dom> {
|
720
|
+
typedef _GBase<_Dom> _Base;
|
721
|
+
typedef typename _Base::value_type value_type;
|
722
|
+
|
723
|
+
_GClos (const _Dom& __e, const valarray<size_t>& __i)
|
724
|
+
: _Base (__e, __i) {}
|
725
|
+
};
|
726
|
+
|
727
|
+
template<typename _Tp>
|
728
|
+
struct _GClos<_ValArray,_Tp> : _GBase<_Array<_Tp> > {
|
729
|
+
typedef _GBase<_Array<_Tp> > _Base;
|
730
|
+
typedef typename _Base::value_type value_type;
|
731
|
+
|
732
|
+
_GClos (_Array<_Tp> __a, const valarray<size_t>& __i)
|
733
|
+
: _Base (__a, __i) {}
|
734
|
+
};
|
735
|
+
|
736
|
+
//
|
737
|
+
// indirect_array closure
|
738
|
+
//
|
739
|
+
|
740
|
+
template<class _Dom> class _IBase {
|
741
|
+
public:
|
742
|
+
typedef typename _Dom::value_type value_type;
|
743
|
+
|
744
|
+
_IBase (const _Dom& __e, const valarray<size_t>& __i)
|
745
|
+
: _M_expr (__e), _M_index (__i) {}
|
746
|
+
value_type operator[] (size_t __i) const;
|
747
|
+
size_t size() const;
|
748
|
+
|
749
|
+
private:
|
750
|
+
const _Dom& _M_expr;
|
751
|
+
const valarray<size_t>& _M_index;
|
752
|
+
};
|
753
|
+
|
754
|
+
template<class _Dom> struct _IClos<_Expr,_Dom> : _IBase<_Dom> {
|
755
|
+
typedef _IBase<_Dom> _Base;
|
756
|
+
typedef typename _Base::value_type value_type;
|
757
|
+
|
758
|
+
_IClos (const _Dom& __e, const valarray<size_t>& __i)
|
759
|
+
: _Base (__e, __i) {}
|
760
|
+
};
|
761
|
+
|
762
|
+
template<typename _Tp>
|
763
|
+
struct _IClos<_ValArray,_Tp> : _IBase<valarray<_Tp> > {
|
764
|
+
typedef _IBase<valarray<_Tp> > _Base;
|
765
|
+
typedef _Tp value_type;
|
766
|
+
|
767
|
+
_IClos (const valarray<_Tp>& __a, const valarray<size_t>& __i)
|
768
|
+
: _Base (__a, __i) {}
|
769
|
+
};
|
770
|
+
|
771
|
+
//
|
772
|
+
// class _Expr
|
773
|
+
//
|
774
|
+
template<class _Clos, typename _Tp>
|
775
|
+
class _Expr
|
776
|
+
{
|
777
|
+
public:
|
778
|
+
typedef _Tp value_type;
|
779
|
+
|
780
|
+
_Expr(const _Clos&);
|
781
|
+
|
782
|
+
const _Clos& operator()() const;
|
783
|
+
|
784
|
+
value_type operator[](size_t) const;
|
785
|
+
valarray<value_type> operator[](slice) const;
|
786
|
+
valarray<value_type> operator[](const gslice&) const;
|
787
|
+
valarray<value_type> operator[](const valarray<bool>&) const;
|
788
|
+
valarray<value_type> operator[](const valarray<size_t>&) const;
|
789
|
+
|
790
|
+
_Expr<_UnClos<__unary_plus,std::_Expr,_Clos>, value_type>
|
791
|
+
operator+() const;
|
792
|
+
|
793
|
+
_Expr<_UnClos<__negate,std::_Expr,_Clos>, value_type>
|
794
|
+
operator-() const;
|
795
|
+
|
796
|
+
_Expr<_UnClos<__bitwise_not,std::_Expr,_Clos>, value_type>
|
797
|
+
operator~() const;
|
798
|
+
|
799
|
+
_Expr<_UnClos<__logical_not,std::_Expr,_Clos>, bool>
|
800
|
+
operator!() const;
|
801
|
+
|
802
|
+
size_t size() const;
|
803
|
+
value_type sum() const;
|
804
|
+
|
805
|
+
valarray<value_type> shift(int) const;
|
806
|
+
valarray<value_type> cshift(int) const;
|
807
|
+
|
808
|
+
value_type min() const;
|
809
|
+
value_type max() const;
|
810
|
+
|
811
|
+
valarray<value_type> apply(value_type (*)(const value_type&)) const;
|
812
|
+
valarray<value_type> apply(value_type (*)(value_type)) const;
|
813
|
+
|
814
|
+
private:
|
815
|
+
const _Clos _M_closure;
|
816
|
+
};
|
817
|
+
|
818
|
+
template<class _Clos, typename _Tp>
|
819
|
+
inline
|
820
|
+
_Expr<_Clos,_Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {}
|
821
|
+
|
822
|
+
template<class _Clos, typename _Tp>
|
823
|
+
inline const _Clos&
|
824
|
+
_Expr<_Clos,_Tp>::operator()() const
|
825
|
+
{ return _M_closure; }
|
826
|
+
|
827
|
+
template<class _Clos, typename _Tp>
|
828
|
+
inline _Tp
|
829
|
+
_Expr<_Clos,_Tp>::operator[](size_t __i) const
|
830
|
+
{ return _M_closure[__i]; }
|
831
|
+
|
832
|
+
template<class _Clos, typename _Tp>
|
833
|
+
inline valarray<_Tp>
|
834
|
+
_Expr<_Clos,_Tp>::operator[](const gslice& __gs) const
|
835
|
+
{ return _M_closure[__gs]; }
|
836
|
+
|
837
|
+
template<class _Clos, typename _Tp>
|
838
|
+
inline valarray<_Tp>
|
839
|
+
_Expr<_Clos,_Tp>::operator[](const valarray<bool>& __m) const
|
840
|
+
{ return _M_closure[__m]; }
|
841
|
+
|
842
|
+
template<class _Clos, typename _Tp>
|
843
|
+
inline valarray<_Tp>
|
844
|
+
_Expr<_Clos,_Tp>::operator[](const valarray<size_t>& __i) const
|
845
|
+
{ return _M_closure[__i]; }
|
846
|
+
|
847
|
+
template<class _Clos, typename _Tp>
|
848
|
+
inline size_t
|
849
|
+
_Expr<_Clos,_Tp>::size() const { return _M_closure.size (); }
|
850
|
+
|
851
|
+
template<class _Clos, typename _Tp>
|
852
|
+
inline valarray<_Tp>
|
853
|
+
_Expr<_Clos, _Tp>::shift(int __n) const
|
854
|
+
{ return valarray<_Tp>(_M_closure).shift(__n); }
|
855
|
+
|
856
|
+
template<class _Clos, typename _Tp>
|
857
|
+
inline valarray<_Tp>
|
858
|
+
_Expr<_Clos, _Tp>::cshift(int __n) const
|
859
|
+
{ return valarray<_Tp>(_M_closure).cshift(__n); }
|
860
|
+
|
861
|
+
template<class _Clos, typename _Tp>
|
862
|
+
inline valarray<_Tp>
|
863
|
+
_Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const
|
864
|
+
{ return valarray<_Tp>(_M_closure).apply(__f); }
|
865
|
+
|
866
|
+
template<class _Clos, typename _Tp>
|
867
|
+
inline valarray<_Tp>
|
868
|
+
_Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const
|
869
|
+
{ return valarray<_Tp>(_M_closure).apply(__f); }
|
870
|
+
|
871
|
+
// XXX: replace this with a more robust summation algorithm.
|
872
|
+
template<class _Clos, typename _Tp>
|
873
|
+
inline _Tp
|
874
|
+
_Expr<_Clos,_Tp>::sum() const
|
875
|
+
{
|
876
|
+
size_t __n = _M_closure.size();
|
877
|
+
if (__n == 0)
|
878
|
+
return _Tp();
|
879
|
+
else
|
880
|
+
{
|
881
|
+
_Tp __s = _M_closure[--__n];
|
882
|
+
while (__n != 0)
|
883
|
+
__s += _M_closure[--__n];
|
884
|
+
return __s;
|
885
|
+
}
|
886
|
+
}
|
887
|
+
|
888
|
+
template<class _Clos, typename _Tp>
|
889
|
+
inline _Tp
|
890
|
+
_Expr<_Clos, _Tp>::min() const
|
891
|
+
{ return __valarray_min(_M_closure); }
|
892
|
+
|
893
|
+
template<class _Clos, typename _Tp>
|
894
|
+
inline _Tp
|
895
|
+
_Expr<_Clos, _Tp>::max() const
|
896
|
+
{ return __valarray_max(_M_closure); }
|
897
|
+
|
898
|
+
template<class _Dom, typename _Tp>
|
899
|
+
inline _Expr<_UnClos<__logical_not,_Expr,_Dom>, bool>
|
900
|
+
_Expr<_Dom,_Tp>::operator!() const
|
901
|
+
{
|
902
|
+
typedef _UnClos<__logical_not,std::_Expr,_Dom> _Closure;
|
903
|
+
return _Expr<_Closure,_Tp>(_Closure(this->_M_closure));
|
904
|
+
}
|
905
|
+
|
906
|
+
#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \
|
907
|
+
template<class _Dom, typename _Tp> \
|
908
|
+
inline _Expr<_UnClos<_Name,std::_Expr,_Dom>,_Tp> \
|
909
|
+
_Expr<_Dom,_Tp>::operator _Op() const \
|
910
|
+
{ \
|
911
|
+
typedef _UnClos<_Name,std::_Expr,_Dom> _Closure; \
|
912
|
+
return _Expr<_Closure,_Tp>(_Closure(this->_M_closure)); \
|
913
|
+
}
|
914
|
+
|
915
|
+
_DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus)
|
916
|
+
_DEFINE_EXPR_UNARY_OPERATOR(-, __negate)
|
917
|
+
_DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not)
|
918
|
+
|
919
|
+
#undef _DEFINE_EXPR_UNARY_OPERATOR
|
920
|
+
|
921
|
+
|
922
|
+
#define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name) \
|
923
|
+
template<class _Dom1, class _Dom2> \
|
924
|
+
inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>, \
|
925
|
+
typename __fun<_Name, typename _Dom1::value_type>::result_type>\
|
926
|
+
operator _Op(const _Expr<_Dom1,typename _Dom1::value_type>& __v, \
|
927
|
+
const _Expr<_Dom2,typename _Dom2::value_type>& __w) \
|
928
|
+
{ \
|
929
|
+
typedef typename _Dom1::value_type _Arg; \
|
930
|
+
typedef typename __fun<_Name, _Arg>::result_type _Value; \
|
931
|
+
typedef _BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2> _Closure; \
|
932
|
+
return _Expr<_Closure,_Value>(_Closure(__v(), __w())); \
|
933
|
+
} \
|
934
|
+
\
|
935
|
+
template<class _Dom> \
|
936
|
+
inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>,\
|
937
|
+
typename __fun<_Name, typename _Dom::value_type>::result_type>\
|
938
|
+
operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __v, \
|
939
|
+
const typename _Dom::value_type& __t) \
|
940
|
+
{ \
|
941
|
+
typedef typename _Dom::value_type _Arg; \
|
942
|
+
typedef typename __fun<_Name, _Arg>::result_type _Value; \
|
943
|
+
typedef _BinClos<_Name,_Expr,_Constant,_Dom,_Arg> _Closure; \
|
944
|
+
return _Expr<_Closure,_Value>(_Closure(__v(), __t)); \
|
945
|
+
} \
|
946
|
+
\
|
947
|
+
template<class _Dom> \
|
948
|
+
inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>,\
|
949
|
+
typename __fun<_Name, typename _Dom::value_type>::result_type>\
|
950
|
+
operator _Op(const typename _Dom::value_type& __t, \
|
951
|
+
const _Expr<_Dom,typename _Dom::value_type>& __v) \
|
952
|
+
{ \
|
953
|
+
typedef typename _Dom::value_type _Arg; \
|
954
|
+
typedef typename __fun<_Name, _Arg>::result_type _Value; \
|
955
|
+
typedef _BinClos<_Name,_Constant,_Expr,_Arg,_Dom> _Closure; \
|
956
|
+
return _Expr<_Closure,_Value>(_Closure(__t, __v())); \
|
957
|
+
} \
|
958
|
+
\
|
959
|
+
template<class _Dom> \
|
960
|
+
inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>,\
|
961
|
+
typename __fun<_Name, typename _Dom::value_type>::result_type>\
|
962
|
+
operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e, \
|
963
|
+
const valarray<typename _Dom::value_type>& __v) \
|
964
|
+
{ \
|
965
|
+
typedef typename _Dom::value_type _Arg; \
|
966
|
+
typedef typename __fun<_Name, _Arg>::result_type _Value; \
|
967
|
+
typedef _BinClos<_Name,_Expr,_ValArray,_Dom,_Arg> _Closure; \
|
968
|
+
return _Expr<_Closure,_Value>(_Closure(__e(), __v)); \
|
969
|
+
} \
|
970
|
+
\
|
971
|
+
template<class _Dom> \
|
972
|
+
inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>,\
|
973
|
+
typename __fun<_Name, typename _Dom::value_type>::result_type>\
|
974
|
+
operator _Op(const valarray<typename _Dom::value_type>& __v, \
|
975
|
+
const _Expr<_Dom,typename _Dom::value_type>& __e) \
|
976
|
+
{ \
|
977
|
+
typedef typename _Dom::value_type _Tp; \
|
978
|
+
typedef typename __fun<_Name, _Tp>::result_type _Value; \
|
979
|
+
typedef _BinClos<_Name,_ValArray,_Expr,_Tp,_Dom> _Closure; \
|
980
|
+
return _Expr<_Closure,_Value> (_Closure (__v, __e ())); \
|
981
|
+
}
|
982
|
+
|
983
|
+
_DEFINE_EXPR_BINARY_OPERATOR(+, __plus)
|
984
|
+
_DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
|
985
|
+
_DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies)
|
986
|
+
_DEFINE_EXPR_BINARY_OPERATOR(/, __divides)
|
987
|
+
_DEFINE_EXPR_BINARY_OPERATOR(%, __modulus)
|
988
|
+
_DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
|
989
|
+
_DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
|
990
|
+
_DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or)
|
991
|
+
_DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left)
|
992
|
+
_DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right)
|
993
|
+
_DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
|
994
|
+
_DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or)
|
995
|
+
_DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to)
|
996
|
+
_DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to)
|
997
|
+
_DEFINE_EXPR_BINARY_OPERATOR(<, __less)
|
998
|
+
_DEFINE_EXPR_BINARY_OPERATOR(>, __greater)
|
999
|
+
_DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal)
|
1000
|
+
_DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal)
|
1001
|
+
|
1002
|
+
#undef _DEFINE_EXPR_BINARY_OPERATOR
|
1003
|
+
|
1004
|
+
#define _DEFINE_EXPR_UNARY_FUNCTION(_Name) \
|
1005
|
+
template<class _Dom> \
|
1006
|
+
inline _Expr<_UnClos<__##_Name,_Expr,_Dom>,typename _Dom::value_type>\
|
1007
|
+
_Name(const _Expr<_Dom,typename _Dom::value_type>& __e) \
|
1008
|
+
{ \
|
1009
|
+
typedef typename _Dom::value_type _Tp; \
|
1010
|
+
typedef _UnClos<__##_Name,_Expr,_Dom> _Closure; \
|
1011
|
+
return _Expr<_Closure,_Tp>(_Closure(__e())); \
|
1012
|
+
} \
|
1013
|
+
\
|
1014
|
+
template<typename _Tp> \
|
1015
|
+
inline _Expr<_UnClos<__##_Name,_ValArray,_Tp>,_Tp> \
|
1016
|
+
_Name(const valarray<_Tp>& __v) \
|
1017
|
+
{ \
|
1018
|
+
typedef _UnClos<__##_Name,_ValArray,_Tp> _Closure; \
|
1019
|
+
return _Expr<_Closure,_Tp>(_Closure(__v)); \
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
_DEFINE_EXPR_UNARY_FUNCTION(abs)
|
1023
|
+
_DEFINE_EXPR_UNARY_FUNCTION(cos)
|
1024
|
+
_DEFINE_EXPR_UNARY_FUNCTION(acos)
|
1025
|
+
_DEFINE_EXPR_UNARY_FUNCTION(cosh)
|
1026
|
+
_DEFINE_EXPR_UNARY_FUNCTION(sin)
|
1027
|
+
_DEFINE_EXPR_UNARY_FUNCTION(asin)
|
1028
|
+
_DEFINE_EXPR_UNARY_FUNCTION(sinh)
|
1029
|
+
_DEFINE_EXPR_UNARY_FUNCTION(tan)
|
1030
|
+
_DEFINE_EXPR_UNARY_FUNCTION(tanh)
|
1031
|
+
_DEFINE_EXPR_UNARY_FUNCTION(atan)
|
1032
|
+
_DEFINE_EXPR_UNARY_FUNCTION(exp)
|
1033
|
+
_DEFINE_EXPR_UNARY_FUNCTION(log)
|
1034
|
+
_DEFINE_EXPR_UNARY_FUNCTION(log10)
|
1035
|
+
_DEFINE_EXPR_UNARY_FUNCTION(sqrt)
|
1036
|
+
|
1037
|
+
#undef _DEFINE_EXPR_UNARY_FUNCTION
|
1038
|
+
|
1039
|
+
#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun) \
|
1040
|
+
template<class _Dom1, class _Dom2> \
|
1041
|
+
inline _Expr<_BinClos<__##_Fun,_Expr,_Expr,_Dom1,_Dom2>, \
|
1042
|
+
typename _Dom1::value_type> \
|
1043
|
+
_Fun(const _Expr<_Dom1,typename _Dom1::value_type>& __e1, \
|
1044
|
+
const _Expr<_Dom2,typename _Dom2::value_type>& __e2) \
|
1045
|
+
{ \
|
1046
|
+
typedef typename _Dom1::value_type _Tp; \
|
1047
|
+
typedef _BinClos<__##_Fun,_Expr,_Expr,_Dom1,_Dom2> _Closure; \
|
1048
|
+
return _Expr<_Closure,_Tp>(_Closure(__e1(), __e2())); \
|
1049
|
+
} \
|
1050
|
+
\
|
1051
|
+
template<class _Dom> \
|
1052
|
+
inline _Expr<_BinClos<__##_Fun, _Expr, _ValArray, _Dom, \
|
1053
|
+
typename _Dom::value_type>, \
|
1054
|
+
typename _Dom::value_type> \
|
1055
|
+
_Fun(const _Expr<_Dom,typename _Dom::value_type>& __e, \
|
1056
|
+
const valarray<typename _Dom::value_type>& __v) \
|
1057
|
+
{ \
|
1058
|
+
typedef typename _Dom::value_type _Tp; \
|
1059
|
+
typedef _BinClos<__##_Fun, _Expr, _ValArray, _Dom, _Tp> _Closure;\
|
1060
|
+
return _Expr<_Closure,_Tp>(_Closure(__e(), __v)); \
|
1061
|
+
} \
|
1062
|
+
\
|
1063
|
+
template<class _Dom> \
|
1064
|
+
inline _Expr<_BinClos<__##_Fun, _ValArray, _Expr, \
|
1065
|
+
typename _Dom::value_type,_Dom>, \
|
1066
|
+
typename _Dom::value_type> \
|
1067
|
+
_Fun(const valarray<typename _Dom::valarray>& __v, \
|
1068
|
+
const _Expr<_Dom,typename _Dom::value_type>& __e) \
|
1069
|
+
{ \
|
1070
|
+
typedef typename _Dom::value_type _Tp; \
|
1071
|
+
typedef _BinClos<__##_Fun,_ValArray,_Expr,_Tp,_Dom> _Closure; \
|
1072
|
+
return _Expr<_Closure,_Tp>(_Closure(__v, __e())); \
|
1073
|
+
} \
|
1074
|
+
\
|
1075
|
+
template<class _Dom> \
|
1076
|
+
inline _Expr<_BinClos<__##_Fun,_Expr,_Constant,_Dom, \
|
1077
|
+
typename _Dom::value_type>, \
|
1078
|
+
typename _Dom::value_type> \
|
1079
|
+
_Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \
|
1080
|
+
const typename _Dom::value_type& __t) \
|
1081
|
+
{ \
|
1082
|
+
typedef typename _Dom::value_type _Tp; \
|
1083
|
+
typedef _BinClos<__##_Fun,_Expr,_Constant,_Dom,_Tp> _Closure; \
|
1084
|
+
return _Expr<_Closure,_Tp>(_Closure(__e(), __t)); \
|
1085
|
+
} \
|
1086
|
+
\
|
1087
|
+
template<class _Dom> \
|
1088
|
+
inline _Expr<_BinClos<__##_Fun,_Constant,_Expr, \
|
1089
|
+
typename _Dom::value_type,_Dom>, \
|
1090
|
+
typename _Dom::value_type> \
|
1091
|
+
_Fun(const typename _Dom::value_type& __t, \
|
1092
|
+
const _Expr<_Dom,typename _Dom::value_type>& __e) \
|
1093
|
+
{ \
|
1094
|
+
typedef typename _Dom::value_type _Tp; \
|
1095
|
+
typedef _BinClos<__##_Fun, _Constant,_Expr,_Tp,_Dom> _Closure; \
|
1096
|
+
return _Expr<_Closure,_Tp>(_Closure(__t, __e())); \
|
1097
|
+
} \
|
1098
|
+
\
|
1099
|
+
template<typename _Tp> \
|
1100
|
+
inline _Expr<_BinClos<__##_Fun,_ValArray,_ValArray,_Tp,_Tp>, _Tp> \
|
1101
|
+
_Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \
|
1102
|
+
{ \
|
1103
|
+
typedef _BinClos<__##_Fun,_ValArray,_ValArray,_Tp,_Tp> _Closure; \
|
1104
|
+
return _Expr<_Closure,_Tp>(_Closure(__v, __w)); \
|
1105
|
+
} \
|
1106
|
+
\
|
1107
|
+
template<typename _Tp> \
|
1108
|
+
inline _Expr<_BinClos<__##_Fun,_ValArray,_Constant,_Tp,_Tp>,_Tp> \
|
1109
|
+
_Fun(const valarray<_Tp>& __v, const _Tp& __t) \
|
1110
|
+
{ \
|
1111
|
+
typedef _BinClos<__##_Fun,_ValArray,_Constant,_Tp,_Tp> _Closure; \
|
1112
|
+
return _Expr<_Closure,_Tp>(_Closure(__v, __t)); \
|
1113
|
+
} \
|
1114
|
+
\
|
1115
|
+
template<typename _Tp> \
|
1116
|
+
inline _Expr<_BinClos<__##_Fun,_Constant,_ValArray,_Tp,_Tp>,_Tp> \
|
1117
|
+
_Fun(const _Tp& __t, const valarray<_Tp>& __v) \
|
1118
|
+
{ \
|
1119
|
+
typedef _BinClos<__##_Fun,_Constant,_ValArray,_Tp,_Tp> _Closure; \
|
1120
|
+
return _Expr<_Closure,_Tp>(_Closure(__t, __v)); \
|
1121
|
+
}
|
1122
|
+
|
1123
|
+
_DEFINE_EXPR_BINARY_FUNCTION(atan2)
|
1124
|
+
_DEFINE_EXPR_BINARY_FUNCTION(pow)
|
1125
|
+
|
1126
|
+
#undef _DEFINE_EXPR_BINARY_FUNCTION
|
1127
|
+
|
1128
|
+
} // std::
|
1129
|
+
|
1130
|
+
|
1131
|
+
#endif /* _CPP_VALARRAY_META_H */
|
1132
|
+
|
1133
|
+
// Local Variables:
|
1134
|
+
// mode:c++
|
1135
|
+
// End:
|