Changeset 1789 for trunk/yat/utility/stl_utility.h
- Timestamp:
- Feb 10, 2009, 5:11:04 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/stl_utility.h
r1786 r1789 77 77 inline T operator()(T x) const 78 78 { return std::abs(x); } 79 };80 81 82 /**83 For each element in resulting range assign it to 0.0 if84 corresponding element in input range is NaN else assign it to85 1.0.86 87 \since New in yat 0.588 */89 struct BinaryWeight90 {91 /**92 \return true if there is at least one NaN in input range93 [first, last).94 */95 template<typename InputIterator, typename OutputIterator>96 bool inline operator()(InputIterator first, InputIterator last,97 OutputIterator result) const98 {99 bool nan=false;100 while (first!=last) {101 if (std::isnan(*first)) {102 *result=0;103 nan=true;104 }105 else106 *result = 1.0;107 ++first;108 ++result;109 }110 return nan;111 }112 79 }; 113 80
Note: See TracChangeset
for help on using the changeset viewer.