1/*
2Copyright 2019 Glen Joseph Fernandes
3(glenjofe@gmail.com)
4
5Distributed under the Boost Software License, Version 1.0.
6(http://www.boost.org/LICENSE_1_0.txt)
7*/
8#ifndef BOOST_CORE_FIRST_SCALAR_HPP
9#define BOOST_CORE_FIRST_SCALAR_HPP
10
11#include <boost/config.hpp>
12#include <cstddef>
13
14namespace boost {
15namespace detail {
16
17template<class T>
18struct make_scalar {
19 typedef T type;
20};
21
22template<class T, std::size_t N>
23struct make_scalar<T[N]> {
24 typedef typename make_scalar<T>::type type;
25};
26
27} /* detail */
28
29template<class T>
30BOOST_CONSTEXPR inline T*
31first_scalar(T* p) BOOST_NOEXCEPT
32{
33 return p;
34}
35
36template<class T, std::size_t N>
37BOOST_CONSTEXPR inline typename detail::make_scalar<T>::type*
38first_scalar(T (*p)[N]) BOOST_NOEXCEPT
39{
40 return boost::first_scalar(&(*p)[0]);
41}
42
43} /* boost */
44
45#endif
46

source code of include/boost/core/first_scalar.hpp