summaryrefslogtreecommitdiff
path: root/boost/fusion/sequence/intrinsic/at.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/fusion/sequence/intrinsic/at.hpp')
-rw-r--r--boost/fusion/sequence/intrinsic/at.hpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/boost/fusion/sequence/intrinsic/at.hpp b/boost/fusion/sequence/intrinsic/at.hpp
index aa0d974..fdfa72a 100644
--- a/boost/fusion/sequence/intrinsic/at.hpp
+++ b/boost/fusion/sequence/intrinsic/at.hpp
@@ -9,6 +9,9 @@
#include <boost/fusion/support/config.hpp>
#include <boost/mpl/int.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/less.hpp>
+#include <boost/mpl/empty_base.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
@@ -56,12 +59,23 @@ namespace boost { namespace fusion
struct at_impl<std_tuple_tag>;
}
+ namespace detail
+ {
+ template <typename Sequence, typename N, typename Tag>
+ struct at_impl
+ : mpl::if_<
+ mpl::less<N, typename extension::size_impl<Tag>::template apply<Sequence>::type>
+ , typename extension::at_impl<Tag>::template apply<Sequence, N>
+ , mpl::empty_base
+ >::type
+ {};
+ }
+
namespace result_of
{
template <typename Sequence, typename N>
struct at
- : extension::at_impl<typename detail::tag_of<Sequence>::type>::
- template apply<Sequence, N>
+ : detail::at_impl<Sequence, N, typename detail::tag_of<Sequence>::type>
{};
template <typename Sequence, int N>
@@ -72,7 +86,7 @@ namespace boost { namespace fusion
template <typename N, typename Sequence>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename
lazy_disable_if<
is_const<Sequence>
@@ -84,7 +98,7 @@ namespace boost { namespace fusion
}
template <typename N, typename Sequence>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::at<Sequence const, N>::type
at(Sequence const& seq)
{
@@ -92,7 +106,7 @@ namespace boost { namespace fusion
}
template <int N, typename Sequence>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename
lazy_disable_if<
is_const<Sequence>
@@ -104,7 +118,7 @@ namespace boost { namespace fusion
}
template <int N, typename Sequence>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::at_c<Sequence const, N>::type
at_c(Sequence const& seq)
{