mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-31 04:57:28 +02:00
added static assert when N is > size of vector
[SVN r84283]
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
/*=============================================================================
|
/*=============================================================================
|
||||||
Copyright (c) 2001-2011 Joel de Guzman
|
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)
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
==============================================================================*/
|
==============================================================================*/
|
||||||
#if !defined(FUSION_AT_IMPL_05042005_0741)
|
#if !defined(FUSION_AT_IMPL_05042005_0741)
|
||||||
@ -25,14 +25,15 @@ namespace boost { namespace fusion
|
|||||||
struct at_impl<vector_tag>
|
struct at_impl<vector_tag>
|
||||||
{
|
{
|
||||||
template <typename Sequence, typename N>
|
template <typename Sequence, typename N>
|
||||||
struct apply
|
struct apply
|
||||||
{
|
{
|
||||||
typedef typename mpl::at<typename Sequence::types, N>::type element;
|
typedef typename mpl::at<typename Sequence::types, N>::type element;
|
||||||
typedef typename detail::ref_result<element>::type type;
|
typedef typename detail::ref_result<element>::type type;
|
||||||
|
|
||||||
static type
|
static type
|
||||||
call(Sequence& v)
|
call(Sequence& v)
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT((N::value < Sequence::size::value));
|
||||||
return v.at_impl(N());
|
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 mpl::at<typename Sequence::types, N>::type element;
|
||||||
typedef typename detail::cref_result<element>::type type;
|
typedef typename detail::cref_result<element>::type type;
|
||||||
|
|
||||||
static type
|
static type
|
||||||
call(Sequence const& v)
|
call(Sequence const& v)
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT((N::value < Sequence::size::value));
|
||||||
return v.at_impl(N());
|
return v.at_impl(N());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user