Boost logo

Boost :

Subject: Re: [boost] Anyone have access to Sun Studio 12 compiler?
From: Lars Viklund (zao_at_[hidden])
Date: 2010-10-21 12:12:25


On Thu, Oct 21, 2010 at 07:49:29AM -0400, David Abrahams wrote:
> At Wed, 20 Oct 2010 12:08:28 -0700,
> Marshall Clow wrote:
> >
> > Yeah - it's complaining about a method in boost::array:
> >
> > // Specific for boost::array: simply returns its elems data member.
> > template <typename T, std::size_t N>
> > T(&get_c_array(boost::array<T,N>& arg))[N]
> > {
> > return arg.elems;
> > }
>
> My guess is it can't parse the function-returning-reference-to-array
> syntax. You can try this instead:
>
> namespace detail
> {
> template <typename T, std::size_t N> struct c_array
> {
> typedef T[N] type;
> };
> }
>
> // Specific for boost::array: simply returns its elems data member.
> template <typename T, std::size_t N>
> typename detail::c_array<T,N>::type& get_c_array(boost::array<T,N>& arg)
> {
> return arg.elems;
> }

That code, together with the corresponding const variant [1] of the second
function, makes building --with-math get past the previous trouble spots
without problems.

As this machine is horribly slow, I haven't finished building yet, but
it seems to fix the problem the reporter reported in his report.

[1]
---8<---
// Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N>
const typename detail::c_array<T,N>::type& get_c_array(const boost::array<T,N>& arg)
{
    return arg.elems;
}
---8<---

-- 
Lars Viklund | zao_at_[hidden]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk