title: Passing a std::vector from native C++ to managed array in C++/CLI and/or C#
body: <p>I have been trying to find a way to pass a std::vector from native C++ code into a static method in a C++/CLI managed class. I am new to C++ (non-managed) and so it is not surprising I have had no luck with this. What I would like is some pointers as to how a std:vector (of any type, but preferably double or int) can be converted to managed C++/CLI arrays and/or C# arrays. Perhaps this cannot be done since I only see examples to do the opposite (i.e. C# to native C++), for example see "<a href="https://stackoverflow.com/questions/6846880/convert-systemarray-to-stdvector">convert System::array to std::vector</a>". Below I summarise my abortive attempts.</p>
  
  <p>I can pass a double vector such as </p>
  
  <pre><code>   vector&lt;vector&lt;double&gt; &gt; dblvec
  </code></pre>
  
  <p>into a method defined in a native C++ class (where the class is in a C++/CLI project), but not into a method defined in a ref class (also in a C++/CLI project). The comiler complains that the method (in the ref class) does not exist (candidate function not accessible). I think this is something to do with vector > being foced to be a private variable (see for example <a href="https://stackoverflow.com/questions/947213/c-cli-candidate-functions-not-accessible">C++ CLI error C3767: candidate function(s) not accessible</a>).  </p>
  
  <p>Any help would be greatly appreciated.</p>