From 171765cfdbdeec8de18fa0a4ea0712b1448b57a8 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sun, 6 Aug 2017 18:19:43 -0600 Subject: [PATCH] Add back in extent capture --- include/chaiscript/dispatchkit/bootstrap.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/chaiscript/dispatchkit/bootstrap.hpp b/include/chaiscript/dispatchkit/bootstrap.hpp index c819024c..8aedb353 100644 --- a/include/chaiscript/dispatchkit/bootstrap.hpp +++ b/include/chaiscript/dispatchkit/bootstrap.hpp @@ -26,7 +26,7 @@ namespace chaiscript const auto extent = std::extent::value; m.add(user_type(), type); m.add(fun( - [](T& t, size_t index)->ReturnType &{ + [extent](T& t, size_t index)->ReturnType &{ if (extent > 0 && index >= extent) { throw std::range_error("Array index out of range. Received: " + std::to_string(index) + " expected < " + std::to_string(extent)); } else { @@ -37,7 +37,7 @@ namespace chaiscript ); m.add(fun( - [](const T &t, size_t index)->const ReturnType &{ + [extent](const T &t, size_t index)->const ReturnType &{ if (extent > 0 && index >= extent) { throw std::range_error("Array index out of range. Received: " + std::to_string(index) + " expected < " + std::to_string(extent)); } else { @@ -48,7 +48,7 @@ namespace chaiscript ); m.add(fun( - [](const T &) { + [extent](const T &) { return extent; }), "size"); }