#ifndef SPROUT_WEED_ATTR_CNV_SHIFT_LEFT_HPP #define SPROUT_WEED_ATTR_CNV_SHIFT_LEFT_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace sprout { namespace weed { namespace attr_cnv { // // shift_left // // container >> container -> container template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_same_container::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return sprout::fixed::append_back(t, u); } // container >> V -> container template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_container_and_elem::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return sprout::fixed::push_back(t, u); } // V >> container -> container template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_elem_and_container::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return sprout::fixed::push_front(t, u); } // tuple >> tuple -> tuple template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_both_tuple::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return sprout::tuples::append_back(t, u); } // tuple >> V -> tuple template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_tuple_and_elem::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return sprout::tuples::push_back(t, u); } // V >> tuple -> tuple template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_elem_and_tuple::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return sprout::tuples::push_front(t, u); } // V >> V -> container template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_same_elem::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { typedef typename sprout::weed::attr_cnv::result_of::shift_left::type type; return sprout::make_clone(t, u); } // V >> W -> tuple template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_different_elem::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return typename sprout::weed::attr_cnv::result_of::shift_left::type(t, u); } // V >> unused -> V template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_elem_and_unused::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return t; } // unused >> V -> V template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_unused_and_elem::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return u; } // unused >> unused -> unused template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::weed::detail::is_both_unused::value, typename sprout::weed::attr_cnv::result_of::shift_left::type >::type shift_left(T const& t, U const& u) { return sprout::weed::unused(); } } // namespace attr_cnv } // namespace weed } // namespace sprout #endif // #ifndef SPROUT_WEED_ATTR_CNV_SHIFT_LEFT_HPP