I've tried what you have suggested but it does not work, here is the error

.../boost_1_33_1/boost/python/object/value_holder.hpp:135: error: no
   matching function for call to `boost::const_multi_array_ref<double, 2, const
   double*>::const_multi_array_ref()'
.../boost_1_33_1/boost/multi_array/multi_array_ref.hpp:45: error: candidates
   are: boost::const_multi_array_ref<double, 2, const
   double*>::const_multi_array_ref(const boost::const_multi_array_ref<double,
   2, const double*>&)
.../boost_1_33_1/boost/multi_array/multi_array_ref.hpp:325: error:
                  boost::const_multi_array_ref<T, NumDims,
   TPtr>::const_multi_array_ref(TPtr, const
   boost::general_storage_order<NumDims>&, typename
   boost::detail::multi_array::multi_array_impl_base<T, NumDims>::index*,
   typename boost::detail::multi_array::multi_array_impl_base<T,
   NumDims>::size_type*) [with T = double, unsigned int NumDims = 2, TPtr =
   const double*]
.../boost_1_33_1/boost/multi_array/multi_array_ref.hpp:120: error:
                  boost::const_multi_array_ref<T, NumDims,
   TPtr>::const_multi_array_ref(TPtr, const
   boost::detail::multi_array::extent_gen<NumDims>&, const
   boost::general_storage_order<NumDims>&) [with T = double, unsigned int
   NumDims = 2, TPtr = const double*]
.../boost_1_33_1/boost/multi_array/multi_array_ref.hpp:111: error:
                  boost::const_multi_array_ref<T, NumDims,
   TPtr>::const_multi_array_ref(TPtr, const
   boost::detail::multi_array::extent_gen<NumDims>&) [with T = double, unsigned
   int NumDims = 2, TPtr = const double*]


my interface file is

// Boost Includes ==============================================================
#include "boost/multi_array.hpp"
#include "boost/python/class.hpp"
#include "boost/python/implicit.hpp"
#include "boost/python/module.hpp"
#include "boost/python.hpp"
#include "boost/cstdint.hpp"

// Includes ====================================================================
#include "Fstd.h"
#include "MatrixAlgorithm2D.h"

// Using =======================================================================
using namespace boost::python;

// Module ======================================================================
BOOST_PYTHON_MODULE(matrix)
{
    class_< Fstd >("Fstd", init< const Fstd& >())
        .def(init< std::string >())
        .def("getTT", &Fstd::getTT)
        .def("getUV", &Fstd::getUV)
    ;

    class_< MatrixAlgorithm2D >("MatrixAlgorithm2D", init<  >())
        .def(init< const MatrixAlgorithm2D& >())
        .def("windChill", &MatrixAlgorithm2D::windChill)
        .def("display_d", &MatrixAlgorithm2D::display_d)
        .staticmethod("windChill")
        .staticmethod("display_d")
    ;

    class_<boost::multi_array<double, 2> >("multi_array_2d");
    class_<boost::const_multi_array_ref<double, 2> >("const_multi_array_ref_2d");
    implicitly_convertible<boost::multi_array<double, 2>, boost::multi_array_ref<double, 2> >();
    implicitly_convertible<boost::multi_array<double, 2>, boost::const_multi_array_ref<double, 2> >();
}

Daniel Wallin wrote:
Sebastien Fortier wrote:
  
Thank you very much Daniel!

I had another question, is it possible to use multi_array and 
const_multi_array_ref together in python.
What I mean is, if I create a multi_array from python through my c++ 
functions and I want to pass this array to another c++ function that 
uses a const_multi_array_ref how do I manage this in the interface file? 
is this possible?

I added class_<const_multi_array_ref<double, 2> 
 >("const_multi_array_2d_ref"); to my interface file but the types seem 
to be incompatible.
    

You need to let Boost.Python know that the types are convertible:

  implicitly_convertible<
      multi_array<double, 2>
    , multi_array_ref<double, 2>
  >();

  implicitly_convertible<
      multi_array<double, 2>
    , const_multi_array_ref<double, 2>
  >();

Should do it. See http://www.boost.org/libs/python/doc/v2/implicit.html.

  
I would prefer to use the const_multi_array_ref with the multi_arrays to 
avoid copies...
    

If you already have multi_array's, why don't you just pass them by
reference?

  


--

Sébastien Fortier