/*============================================================================= Copyright (c) 2011-2016 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_VALARRAY_LOGICAL_HPP #define SPROUT_VALARRAY_LOGICAL_HPP #include #include #include #include #include #include #include #include #include namespace sprout { // // operator&& // template inline SPROUT_CONSTEXPR sprout::valarray operator&&(sprout::valarray const& lhs, sprout::valarray const& rhs) { typedef sprout::sized_pit > sized_pit_type; return sprout::fixed::transform(lhs.begin(), lhs.end(), rhs.begin(), sized_pit_type(lhs.size()), sprout::logical_and<>()); } template inline SPROUT_CONSTEXPR sprout::valarray operator&&(sprout::valarray const& lhs, T const& rhs) { typedef sprout::sized_pit > sized_pit_type; return sprout::fixed::transform(lhs.begin(), lhs.end(), sized_pit_type(lhs.size()), sprout::bind2nd(sprout::logical_and<>(), rhs)); } template inline SPROUT_CONSTEXPR sprout::valarray operator&&(T const& lhs, sprout::valarray const& rhs) { typedef sprout::sized_pit > sized_pit_type; return sprout::fixed::transform(rhs.begin(), rhs.end(), sized_pit_type(rhs.size()), sprout::bind1st(sprout::logical_and<>(), lhs)); } // // operator|| // template inline SPROUT_CONSTEXPR sprout::valarray operator||(sprout::valarray const& lhs, sprout::valarray const& rhs) { typedef sprout::sized_pit > sized_pit_type; return sprout::fixed::transform(lhs.begin(), lhs.end(), rhs.begin(), sized_pit_type(lhs.size()), sprout::logical_or<>()); } template inline SPROUT_CONSTEXPR sprout::valarray operator||(sprout::valarray const& lhs, T const& rhs) { typedef sprout::sized_pit > sized_pit_type; return sprout::fixed::transform(lhs.begin(), lhs.end(), sized_pit_type(lhs.size()), sprout::bind2nd(sprout::logical_or<>(), rhs)); } template inline SPROUT_CONSTEXPR sprout::valarray operator||(T const& lhs, sprout::valarray const& rhs) { typedef sprout::sized_pit > sized_pit_type; return sprout::fixed::transform(rhs.begin(), rhs.end(), sized_pit_type(rhs.size()), sprout::bind1st(sprout::logical_or<>(), lhs)); } } // namespace sprout #endif // #ifndef SPROUT_VALARRAY_LOGICAL_HPP