Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84283 - trunk/boost/fusion/container/vector/detail
From: joel_at_[hidden]
Date: 2013-05-14 17:10:03


Author: djowel
Date: 2013-05-14 17:10:02 EDT (Tue, 14 May 2013)
New Revision: 84283
URL: http://svn.boost.org/trac/boost/changeset/84283

Log:
added static assert when N is > size of vector
Text files modified:
   trunk/boost/fusion/container/vector/detail/at_impl.hpp | 10 ++++++----
   1 files changed, 6 insertions(+), 4 deletions(-)

Modified: trunk/boost/fusion/container/vector/detail/at_impl.hpp
==============================================================================
--- trunk/boost/fusion/container/vector/detail/at_impl.hpp (original)
+++ trunk/boost/fusion/container/vector/detail/at_impl.hpp 2013-05-14 17:10:02 EDT (Tue, 14 May 2013)
@@ -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 @@
         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 @@
             {
                 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());
                 }
             };


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk