summaryrefslogtreecommitdiff
path: root/boost/fusion/sequence/intrinsic/value_at.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/fusion/sequence/intrinsic/value_at.hpp')
-rw-r--r--boost/fusion/sequence/intrinsic/value_at.hpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/boost/fusion/sequence/intrinsic/value_at.hpp b/boost/fusion/sequence/intrinsic/value_at.hpp
index 362669b521..152f0c9455 100644
--- a/boost/fusion/sequence/intrinsic/value_at.hpp
+++ b/boost/fusion/sequence/intrinsic/value_at.hpp
@@ -9,8 +9,13 @@
#include <boost/fusion/support/config.hpp>
#include <boost/mpl/int.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/less.hpp>
+#include <boost/mpl/empty_base.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
+#include <boost/fusion/support/category_of.hpp>
namespace boost { namespace fusion
{
@@ -50,12 +55,26 @@ namespace boost { namespace fusion
struct value_at_impl<std_pair_tag>;
}
+ namespace detail
+ {
+ template <typename Sequence, typename N, typename Tag>
+ struct value_at_impl
+ : mpl::if_<
+ mpl::or_<
+ mpl::less<N, typename extension::size_impl<Tag>::template apply<Sequence>::type>
+ , traits::is_unbounded<Sequence>
+ >
+ , typename extension::value_at_impl<Tag>::template apply<Sequence, N>
+ , mpl::empty_base
+ >::type
+ {};
+ }
+
namespace result_of
{
template <typename Sequence, typename N>
struct value_at
- : extension::value_at_impl<typename detail::tag_of<Sequence>::type>::
- template apply<Sequence, N>
+ : detail::value_at_impl<Sequence, N, typename detail::tag_of<Sequence>::type>
{};
template <typename Sequence, int N>