added static assert when N is > size of vector

[SVN r84283]
This commit is contained in:
Joel de Guzman
2013-05-14 21:10:02 +00:00
parent e83960d3e9
commit 56d0d48eb9

View File

@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
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)
==============================================================================*/
#if !defined(FUSION_AT_IMPL_05042005_0741)
@ -25,14 +25,15 @@ namespace boost { namespace fusion
struct at_impl<vector_tag>
{
template <typename Sequence, typename N>
struct apply
struct apply
{
typedef typename mpl::at<typename Sequence::types, N>::type element;
typedef typename detail::ref_result<element>::type type;
static type
call(Sequence& v)
{
BOOST_STATIC_ASSERT((N::value < Sequence::size::value));
return v.at_impl(N());
}
};
@ -42,10 +43,11 @@ namespace boost { namespace fusion
{
typedef typename mpl::at<typename Sequence::types, N>::type element;
typedef typename detail::cref_result<element>::type type;
static type
call(Sequence const& v)
{
BOOST_STATIC_ASSERT((N::value < Sequence::size::value));
return v.at_impl(N());
}
};