I wrote an operator<< specialization that handles boost::multi_array, and used ConstMultiArrayConcept so that it would work on both the outer array and the sub-arrays. I'm wondering, though, why the multi_array concepts have a std::size_t NumDims template argument, since that can be simply extracted from the multi_array. The only use of NumDims in ConstMultiArrayConcept is as a recursion depth arg for idgen_helper, which tests slicing.
For reference, here's the header for multi_array concepts:
http://www.boost.org/doc/libs/1_51_0/boost/multi_array/concept_checks.hpp
And here's my overloaded operator<<
template <typename CharT, typename Traits, typename MultiArrayT>
BOOST_CONCEPT_REQUIRES(
                       ((boost::multi_array_concepts::ConstMultiArrayConcept<MultiArrayT, MultiArrayT::dimensionality>)),
                       (std::basic_ostream<CharT, Traits>&)) // return type
operator <<( std::basic_ostream<CharT, Traits>& os, MultiArrayT const& ary )
{
    typename std::basic_ostream<CharT, Traits>::sentry opfx( os );
    if ( opfx ) {
        boost::multi_array_types::size_type const* sizes = ary.shape();
        // using Mathematica array notation
        os << "{";
        for ( int i = 0; i < sizes[0]; ++i ) {
            if ( i > 0 ) os << ", ";
            // verbose just to keep the types apparent
            typedef typename MultiArrayT::const_reference subType;
            subType item = ary[i];
            os << item;
        }
        os << "}\n";
    }
    return os;
}
This specialization works, but I must be missing something in my understanding. Any clues will be appreciated.
 
     
    