valarray_after.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. // The template and inlines for the -*- C++ -*- internal _Meta class.
  2. // Copyright (C) 1997-2018 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // Under Section 7 of GPL version 3, you are granted additional
  14. // permissions described in the GCC Runtime Library Exception, version
  15. // 3.1, as published by the Free Software Foundation.
  16. // You should have received a copy of the GNU General Public License and
  17. // a copy of the GCC Runtime Library Exception along with this program;
  18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. // <http://www.gnu.org/licenses/>.
  20. /** @file bits/valarray_after.h
  21. * This is an internal header file, included by other library headers.
  22. * Do not attempt to use it directly. @headername{valarray}
  23. */
  24. // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
  25. #ifndef _VALARRAY_AFTER_H
  26. #define _VALARRAY_AFTER_H 1
  27. #pragma GCC system_header
  28. namespace std _GLIBCXX_VISIBILITY(default)
  29. {
  30. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  31. //
  32. // gslice_array closure.
  33. //
  34. template<class _Dom>
  35. class _GBase
  36. {
  37. public:
  38. typedef typename _Dom::value_type value_type;
  39. _GBase (const _Dom& __e, const valarray<size_t>& __i)
  40. : _M_expr (__e), _M_index(__i) {}
  41. value_type
  42. operator[] (size_t __i) const
  43. { return _M_expr[_M_index[__i]]; }
  44. size_t
  45. size () const
  46. { return _M_index.size(); }
  47. private:
  48. const _Dom& _M_expr;
  49. const valarray<size_t>& _M_index;
  50. };
  51. template<typename _Tp>
  52. class _GBase<_Array<_Tp> >
  53. {
  54. public:
  55. typedef _Tp value_type;
  56. _GBase (_Array<_Tp> __a, const valarray<size_t>& __i)
  57. : _M_array (__a), _M_index(__i) {}
  58. value_type
  59. operator[] (size_t __i) const
  60. { return _M_array._M_data[_M_index[__i]]; }
  61. size_t
  62. size () const
  63. { return _M_index.size(); }
  64. private:
  65. const _Array<_Tp> _M_array;
  66. const valarray<size_t>& _M_index;
  67. };
  68. template<class _Dom>
  69. struct _GClos<_Expr, _Dom>
  70. : _GBase<_Dom>
  71. {
  72. typedef _GBase<_Dom> _Base;
  73. typedef typename _Base::value_type value_type;
  74. _GClos (const _Dom& __e, const valarray<size_t>& __i)
  75. : _Base (__e, __i) {}
  76. };
  77. template<typename _Tp>
  78. struct _GClos<_ValArray, _Tp>
  79. : _GBase<_Array<_Tp> >
  80. {
  81. typedef _GBase<_Array<_Tp> > _Base;
  82. typedef typename _Base::value_type value_type;
  83. _GClos (_Array<_Tp> __a, const valarray<size_t>& __i)
  84. : _Base (__a, __i) {}
  85. };
  86. //
  87. // indirect_array closure
  88. //
  89. template<class _Dom>
  90. class _IBase
  91. {
  92. public:
  93. typedef typename _Dom::value_type value_type;
  94. _IBase (const _Dom& __e, const valarray<size_t>& __i)
  95. : _M_expr (__e), _M_index (__i) {}
  96. value_type
  97. operator[] (size_t __i) const
  98. { return _M_expr[_M_index[__i]]; }
  99. size_t
  100. size() const
  101. { return _M_index.size(); }
  102. private:
  103. const _Dom& _M_expr;
  104. const valarray<size_t>& _M_index;
  105. };
  106. template<class _Dom>
  107. struct _IClos<_Expr, _Dom>
  108. : _IBase<_Dom>
  109. {
  110. typedef _IBase<_Dom> _Base;
  111. typedef typename _Base::value_type value_type;
  112. _IClos (const _Dom& __e, const valarray<size_t>& __i)
  113. : _Base (__e, __i) {}
  114. };
  115. template<typename _Tp>
  116. struct _IClos<_ValArray, _Tp>
  117. : _IBase<valarray<_Tp> >
  118. {
  119. typedef _IBase<valarray<_Tp> > _Base;
  120. typedef _Tp value_type;
  121. _IClos (const valarray<_Tp>& __a, const valarray<size_t>& __i)
  122. : _Base (__a, __i) {}
  123. };
  124. //
  125. // class _Expr
  126. //
  127. template<class _Clos, typename _Tp>
  128. class _Expr
  129. {
  130. public:
  131. typedef _Tp value_type;
  132. _Expr(const _Clos&);
  133. const _Clos& operator()() const;
  134. value_type operator[](size_t) const;
  135. valarray<value_type> operator[](slice) const;
  136. valarray<value_type> operator[](const gslice&) const;
  137. valarray<value_type> operator[](const valarray<bool>&) const;
  138. valarray<value_type> operator[](const valarray<size_t>&) const;
  139. _Expr<_UnClos<__unary_plus, std::_Expr, _Clos>, value_type>
  140. operator+() const;
  141. _Expr<_UnClos<__negate, std::_Expr, _Clos>, value_type>
  142. operator-() const;
  143. _Expr<_UnClos<__bitwise_not, std::_Expr, _Clos>, value_type>
  144. operator~() const;
  145. _Expr<_UnClos<__logical_not, std::_Expr, _Clos>, bool>
  146. operator!() const;
  147. size_t size() const;
  148. value_type sum() const;
  149. valarray<value_type> shift(int) const;
  150. valarray<value_type> cshift(int) const;
  151. value_type min() const;
  152. value_type max() const;
  153. valarray<value_type> apply(value_type (*)(const value_type&)) const;
  154. valarray<value_type> apply(value_type (*)(value_type)) const;
  155. private:
  156. const _Clos _M_closure;
  157. };
  158. template<class _Clos, typename _Tp>
  159. inline
  160. _Expr<_Clos, _Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {}
  161. template<class _Clos, typename _Tp>
  162. inline const _Clos&
  163. _Expr<_Clos, _Tp>::operator()() const
  164. { return _M_closure; }
  165. template<class _Clos, typename _Tp>
  166. inline _Tp
  167. _Expr<_Clos, _Tp>::operator[](size_t __i) const
  168. { return _M_closure[__i]; }
  169. template<class _Clos, typename _Tp>
  170. inline valarray<_Tp>
  171. _Expr<_Clos, _Tp>::operator[](slice __s) const
  172. {
  173. valarray<_Tp> __v = valarray<_Tp>(*this)[__s];
  174. return __v;
  175. }
  176. template<class _Clos, typename _Tp>
  177. inline valarray<_Tp>
  178. _Expr<_Clos, _Tp>::operator[](const gslice& __gs) const
  179. {
  180. valarray<_Tp> __v = valarray<_Tp>(*this)[__gs];
  181. return __v;
  182. }
  183. template<class _Clos, typename _Tp>
  184. inline valarray<_Tp>
  185. _Expr<_Clos, _Tp>::operator[](const valarray<bool>& __m) const
  186. {
  187. valarray<_Tp> __v = valarray<_Tp>(*this)[__m];
  188. return __v;
  189. }
  190. template<class _Clos, typename _Tp>
  191. inline valarray<_Tp>
  192. _Expr<_Clos, _Tp>::operator[](const valarray<size_t>& __i) const
  193. {
  194. valarray<_Tp> __v = valarray<_Tp>(*this)[__i];
  195. return __v;
  196. }
  197. template<class _Clos, typename _Tp>
  198. inline size_t
  199. _Expr<_Clos, _Tp>::size() const
  200. { return _M_closure.size(); }
  201. template<class _Clos, typename _Tp>
  202. inline valarray<_Tp>
  203. _Expr<_Clos, _Tp>::shift(int __n) const
  204. {
  205. valarray<_Tp> __v = valarray<_Tp>(*this).shift(__n);
  206. return __v;
  207. }
  208. template<class _Clos, typename _Tp>
  209. inline valarray<_Tp>
  210. _Expr<_Clos, _Tp>::cshift(int __n) const
  211. {
  212. valarray<_Tp> __v = valarray<_Tp>(*this).cshift(__n);
  213. return __v;
  214. }
  215. template<class _Clos, typename _Tp>
  216. inline valarray<_Tp>
  217. _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const
  218. {
  219. valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f);
  220. return __v;
  221. }
  222. template<class _Clos, typename _Tp>
  223. inline valarray<_Tp>
  224. _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const
  225. {
  226. valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f);
  227. return __v;
  228. }
  229. // XXX: replace this with a more robust summation algorithm.
  230. template<class _Clos, typename _Tp>
  231. inline _Tp
  232. _Expr<_Clos, _Tp>::sum() const
  233. {
  234. size_t __n = _M_closure.size();
  235. if (__n == 0)
  236. return _Tp();
  237. else
  238. {
  239. _Tp __s = _M_closure[--__n];
  240. while (__n != 0)
  241. __s += _M_closure[--__n];
  242. return __s;
  243. }
  244. }
  245. template<class _Clos, typename _Tp>
  246. inline _Tp
  247. _Expr<_Clos, _Tp>::min() const
  248. { return __valarray_min(_M_closure); }
  249. template<class _Clos, typename _Tp>
  250. inline _Tp
  251. _Expr<_Clos, _Tp>::max() const
  252. { return __valarray_max(_M_closure); }
  253. template<class _Dom, typename _Tp>
  254. inline _Expr<_UnClos<__logical_not, _Expr, _Dom>, bool>
  255. _Expr<_Dom, _Tp>::operator!() const
  256. {
  257. typedef _UnClos<__logical_not, std::_Expr, _Dom> _Closure;
  258. return _Expr<_Closure, bool>(_Closure(this->_M_closure));
  259. }
  260. #define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \
  261. template<class _Dom, typename _Tp> \
  262. inline _Expr<_UnClos<_Name, std::_Expr, _Dom>, _Tp> \
  263. _Expr<_Dom, _Tp>::operator _Op() const \
  264. { \
  265. typedef _UnClos<_Name, std::_Expr, _Dom> _Closure; \
  266. return _Expr<_Closure, _Tp>(_Closure(this->_M_closure)); \
  267. }
  268. _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus)
  269. _DEFINE_EXPR_UNARY_OPERATOR(-, __negate)
  270. _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not)
  271. #undef _DEFINE_EXPR_UNARY_OPERATOR
  272. #define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name) \
  273. template<class _Dom1, class _Dom2> \
  274. inline _Expr<_BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2>, \
  275. typename __fun<_Name, typename _Dom1::value_type>::result_type> \
  276. operator _Op(const _Expr<_Dom1, typename _Dom1::value_type>& __v, \
  277. const _Expr<_Dom2, typename _Dom2::value_type>& __w) \
  278. { \
  279. typedef typename _Dom1::value_type _Arg; \
  280. typedef typename __fun<_Name, _Arg>::result_type _Value; \
  281. typedef _BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2> _Closure; \
  282. return _Expr<_Closure, _Value>(_Closure(__v(), __w())); \
  283. } \
  284. \
  285. template<class _Dom> \
  286. inline _Expr<_BinClos<_Name, _Expr, _Constant, _Dom, \
  287. typename _Dom::value_type>, \
  288. typename __fun<_Name, typename _Dom::value_type>::result_type> \
  289. operator _Op(const _Expr<_Dom, typename _Dom::value_type>& __v, \
  290. const typename _Dom::value_type& __t) \
  291. { \
  292. typedef typename _Dom::value_type _Arg; \
  293. typedef typename __fun<_Name, _Arg>::result_type _Value; \
  294. typedef _BinClos<_Name, _Expr, _Constant, _Dom, _Arg> _Closure; \
  295. return _Expr<_Closure, _Value>(_Closure(__v(), __t)); \
  296. } \
  297. \
  298. template<class _Dom> \
  299. inline _Expr<_BinClos<_Name, _Constant, _Expr, \
  300. typename _Dom::value_type, _Dom>, \
  301. typename __fun<_Name, typename _Dom::value_type>::result_type> \
  302. operator _Op(const typename _Dom::value_type& __t, \
  303. const _Expr<_Dom, typename _Dom::value_type>& __v) \
  304. { \
  305. typedef typename _Dom::value_type _Arg; \
  306. typedef typename __fun<_Name, _Arg>::result_type _Value; \
  307. typedef _BinClos<_Name, _Constant, _Expr, _Arg, _Dom> _Closure; \
  308. return _Expr<_Closure, _Value>(_Closure(__t, __v())); \
  309. } \
  310. \
  311. template<class _Dom> \
  312. inline _Expr<_BinClos<_Name, _Expr, _ValArray, \
  313. _Dom, typename _Dom::value_type>, \
  314. typename __fun<_Name, typename _Dom::value_type>::result_type> \
  315. operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e, \
  316. const valarray<typename _Dom::value_type>& __v) \
  317. { \
  318. typedef typename _Dom::value_type _Arg; \
  319. typedef typename __fun<_Name, _Arg>::result_type _Value; \
  320. typedef _BinClos<_Name, _Expr, _ValArray, _Dom, _Arg> _Closure; \
  321. return _Expr<_Closure, _Value>(_Closure(__e(), __v)); \
  322. } \
  323. \
  324. template<class _Dom> \
  325. inline _Expr<_BinClos<_Name, _ValArray, _Expr, \
  326. typename _Dom::value_type, _Dom>, \
  327. typename __fun<_Name, typename _Dom::value_type>::result_type> \
  328. operator _Op(const valarray<typename _Dom::value_type>& __v, \
  329. const _Expr<_Dom, typename _Dom::value_type>& __e) \
  330. { \
  331. typedef typename _Dom::value_type _Tp; \
  332. typedef typename __fun<_Name, _Tp>::result_type _Value; \
  333. typedef _BinClos<_Name, _ValArray, _Expr, _Tp, _Dom> _Closure; \
  334. return _Expr<_Closure, _Value>(_Closure(__v, __e ())); \
  335. }
  336. _DEFINE_EXPR_BINARY_OPERATOR(+, __plus)
  337. _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
  338. _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies)
  339. _DEFINE_EXPR_BINARY_OPERATOR(/, __divides)
  340. _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus)
  341. _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
  342. _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
  343. _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or)
  344. _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left)
  345. _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right)
  346. _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
  347. _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or)
  348. _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to)
  349. _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to)
  350. _DEFINE_EXPR_BINARY_OPERATOR(<, __less)
  351. _DEFINE_EXPR_BINARY_OPERATOR(>, __greater)
  352. _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal)
  353. _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal)
  354. #undef _DEFINE_EXPR_BINARY_OPERATOR
  355. #define _DEFINE_EXPR_UNARY_FUNCTION(_Name, _UName) \
  356. template<class _Dom> \
  357. inline _Expr<_UnClos<_UName, _Expr, _Dom>, \
  358. typename _Dom::value_type> \
  359. _Name(const _Expr<_Dom, typename _Dom::value_type>& __e) \
  360. { \
  361. typedef typename _Dom::value_type _Tp; \
  362. typedef _UnClos<_UName, _Expr, _Dom> _Closure; \
  363. return _Expr<_Closure, _Tp>(_Closure(__e())); \
  364. } \
  365. \
  366. template<typename _Tp> \
  367. inline _Expr<_UnClos<_UName, _ValArray, _Tp>, _Tp> \
  368. _Name(const valarray<_Tp>& __v) \
  369. { \
  370. typedef _UnClos<_UName, _ValArray, _Tp> _Closure; \
  371. return _Expr<_Closure, _Tp>(_Closure(__v)); \
  372. }
  373. _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs)
  374. _DEFINE_EXPR_UNARY_FUNCTION(cos, _Cos)
  375. _DEFINE_EXPR_UNARY_FUNCTION(acos, _Acos)
  376. _DEFINE_EXPR_UNARY_FUNCTION(cosh, _Cosh)
  377. _DEFINE_EXPR_UNARY_FUNCTION(sin, _Sin)
  378. _DEFINE_EXPR_UNARY_FUNCTION(asin, _Asin)
  379. _DEFINE_EXPR_UNARY_FUNCTION(sinh, _Sinh)
  380. _DEFINE_EXPR_UNARY_FUNCTION(tan, _Tan)
  381. _DEFINE_EXPR_UNARY_FUNCTION(tanh, _Tanh)
  382. _DEFINE_EXPR_UNARY_FUNCTION(atan, _Atan)
  383. _DEFINE_EXPR_UNARY_FUNCTION(exp, _Exp)
  384. _DEFINE_EXPR_UNARY_FUNCTION(log, _Log)
  385. _DEFINE_EXPR_UNARY_FUNCTION(log10, _Log10)
  386. _DEFINE_EXPR_UNARY_FUNCTION(sqrt, _Sqrt)
  387. #undef _DEFINE_EXPR_UNARY_FUNCTION
  388. #define _DEFINE_EXPR_BINARY_FUNCTION(_Fun, _UFun) \
  389. template<class _Dom1, class _Dom2> \
  390. inline _Expr<_BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2>, \
  391. typename _Dom1::value_type> \
  392. _Fun(const _Expr<_Dom1, typename _Dom1::value_type>& __e1, \
  393. const _Expr<_Dom2, typename _Dom2::value_type>& __e2) \
  394. { \
  395. typedef typename _Dom1::value_type _Tp; \
  396. typedef _BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2> _Closure; \
  397. return _Expr<_Closure, _Tp>(_Closure(__e1(), __e2())); \
  398. } \
  399. \
  400. template<class _Dom> \
  401. inline _Expr<_BinClos<_UFun, _Expr, _ValArray, _Dom, \
  402. typename _Dom::value_type>, \
  403. typename _Dom::value_type> \
  404. _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \
  405. const valarray<typename _Dom::value_type>& __v) \
  406. { \
  407. typedef typename _Dom::value_type _Tp; \
  408. typedef _BinClos<_UFun, _Expr, _ValArray, _Dom, _Tp> _Closure; \
  409. return _Expr<_Closure, _Tp>(_Closure(__e(), __v)); \
  410. } \
  411. \
  412. template<class _Dom> \
  413. inline _Expr<_BinClos<_UFun, _ValArray, _Expr, \
  414. typename _Dom::value_type, _Dom>, \
  415. typename _Dom::value_type> \
  416. _Fun(const valarray<typename _Dom::valarray>& __v, \
  417. const _Expr<_Dom, typename _Dom::value_type>& __e) \
  418. { \
  419. typedef typename _Dom::value_type _Tp; \
  420. typedef _BinClos<_UFun, _ValArray, _Expr, _Tp, _Dom> _Closure; \
  421. return _Expr<_Closure, _Tp>(_Closure(__v, __e())); \
  422. } \
  423. \
  424. template<class _Dom> \
  425. inline _Expr<_BinClos<_UFun, _Expr, _Constant, _Dom, \
  426. typename _Dom::value_type>, \
  427. typename _Dom::value_type> \
  428. _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \
  429. const typename _Dom::value_type& __t) \
  430. { \
  431. typedef typename _Dom::value_type _Tp; \
  432. typedef _BinClos<_UFun, _Expr, _Constant, _Dom, _Tp> _Closure; \
  433. return _Expr<_Closure, _Tp>(_Closure(__e(), __t)); \
  434. } \
  435. \
  436. template<class _Dom> \
  437. inline _Expr<_BinClos<_UFun, _Constant, _Expr, \
  438. typename _Dom::value_type, _Dom>, \
  439. typename _Dom::value_type> \
  440. _Fun(const typename _Dom::value_type& __t, \
  441. const _Expr<_Dom, typename _Dom::value_type>& __e) \
  442. { \
  443. typedef typename _Dom::value_type _Tp; \
  444. typedef _BinClos<_UFun, _Constant, _Expr, _Tp, _Dom> _Closure; \
  445. return _Expr<_Closure, _Tp>(_Closure(__t, __e())); \
  446. } \
  447. \
  448. template<typename _Tp> \
  449. inline _Expr<_BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \
  450. _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \
  451. { \
  452. typedef _BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp> _Closure;\
  453. return _Expr<_Closure, _Tp>(_Closure(__v, __w)); \
  454. } \
  455. \
  456. template<typename _Tp> \
  457. inline _Expr<_BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \
  458. _Fun(const valarray<_Tp>& __v, const _Tp& __t) \
  459. { \
  460. typedef _BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp> _Closure;\
  461. return _Expr<_Closure, _Tp>(_Closure(__v, __t)); \
  462. } \
  463. \
  464. template<typename _Tp> \
  465. inline _Expr<_BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \
  466. _Fun(const _Tp& __t, const valarray<_Tp>& __v) \
  467. { \
  468. typedef _BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp> _Closure;\
  469. return _Expr<_Closure, _Tp>(_Closure(__t, __v)); \
  470. }
  471. _DEFINE_EXPR_BINARY_FUNCTION(atan2, _Atan2)
  472. _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
  473. #undef _DEFINE_EXPR_BINARY_FUNCTION
  474. _GLIBCXX_END_NAMESPACE_VERSION
  475. } // namespace
  476. #endif /* _CPP_VALARRAY_AFTER_H */