473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Passing containers between C# and C++

How do I pass a container from C# to C++?

My client is writing an app in C# that needs to pass a collection of 3-
space vectors to my native C++ library. It will also need to read back the
collection.

In pure native C++, I'd just pass a "std::vector<MyType>&" where MyType is
an x/y/z vector (which might contain a std::vector<double>).

What's the portable C++/CLI equivalent that C# can easily deal with?

The passed container might hold from 10,000 to 100,000 objects.
Jun 27 '08 #1
2 1225
I might misunderstand your requirement, but you could always use
List<List<int>^or something (List from System::Collections::Generic).

--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
VB to Java
Java to VB & C#
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB, C#, or Java to C++/CLI
"Kenneth Porter" wrote:
How do I pass a container from C# to C++?

My client is writing an app in C# that needs to pass a collection of 3-
space vectors to my native C++ library. It will also need to read back the
collection.

In pure native C++, I'd just pass a "std::vector<MyType>&" where MyType is
an x/y/z vector (which might contain a std::vector<double>).

What's the portable C++/CLI equivalent that C# can easily deal with?

The passed container might hold from 10,000 to 100,000 objects.
Jun 27 '08 #2
=?Utf-8?B?RGF2aWQgQW50b24=?= <Da********@discussions.microsoft.comwrote
in news:40**********************************@microsof t.com:
I might misunderstand your requirement, but you could always use
List<List<int>^or something (List from System::Collections::Generic).
Thanks, that sounds like the right thing.
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: nifsmith | last post by:
Hi I am trying to learn about Queues and use templates at the same time. I have written the following code and I am getting a link error, stating "unresolved external symbol, "int__cdecl...
9
by: justanotherguy63 | last post by:
Hi, I am designing an application where to preserve the hierachy and for code substitability, I need to pass an array of derived class object in place of an array of base class object. Since I...
5
by: lugal | last post by:
This might be more appropriate here. I'm new to C++, coming from a background in another languages that allowed a similar solution to work (Python). I wrote the following code in C++ based on the...
4
by: hardwareman | last post by:
Hi Folks, I can work around this problem, but it shows a problem in my understanding of how things should work. Any ideas are appreciated. Thanks, Hardwareman When the following...
3
by: KK | last post by:
Hello all, I have several classes binded by one common interface - say 'sum' interface which calculates the sum of all the class elements of type 'int'. class Alphabet { int _a; int _b; int...
15
by: mangesh | last post by:
This code is from c++ faq in section 11 : void someCode() { char memory; void* p = memory; Fred* f = new(p) Fred(); f->~Fred(); // Explicitly call the destructor for the placed object }
9
by: rob.kirkpatrick | last post by:
Hello I need to populate an array of char arrays at run-time. A very simplifed version of the code is below. char ** list should contain cnt char arrays. The values of char ** list are set by...
15
by: Nindi73 | last post by:
HI If I define the class DoubleMap such that struct DoubleMap : public std::map<std::string, double>{}; Is there any overhead in calling std::map member functions ? Moreover are STL...
6
by: osama178 | last post by:
Let's say I have this code -------------------- class GenericQueue { public: bool Pop(void*& refToPtr); //--------------(1) };
7
by: Nates | last post by:
I have built a quote engine for the rating of insurance premiums. Each month the rates that generate the premiums change which requires a new database file be created with updated premium tables (we...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.