From 64e5394540dbb6b0a88124be96572b97e09f8f33 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Sun, 6 Jun 2010 16:05:13 +0000 Subject: [PATCH] Added get_c_array to Boost.Array [SVN r62487] --- include/boost/array.hpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/boost/array.hpp b/include/boost/array.hpp index b14a148..5925636 100644 --- a/include/boost/array.hpp +++ b/include/boost/array.hpp @@ -346,6 +346,38 @@ namespace boost { x.swap(y); } + // Specific for boost::array: simply returns its elems data member. + template + T(&get_c_array(boost::array& arg))[N] + { + return arg.elems; + } + + // Const version. + template + const T(&get_c_array(const boost::array& arg))[N] + { + return arg.elems; + } + +#if 0 + // Overload for std::array, assuming that std::array will have + // explicit conversion functions as discussed at the WG21 meeting + // in Summit, March 2009. + template + T(&get_c_array(std::array& arg))[N] + { + return static_cast(arg); + } + + // Const version. + template + const T(&get_c_array(const std::array& arg))[N] + { + return static_cast(arg); + } +#endif + } /* namespace boost */