Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 04-04-2004
yomi yomi is offline
Registered User
 
 
Join Date: Aug 2003
Posts: 32
slice array type mapping to c++

Hello. After read slice data type mapping, it is pointed out that array type is mapping to std::vector in c++. But std::vector seems limited in many cases.

For example, if I have an image to transfer from the client to server.
So my image is already in memory, if use std::vector, because it is value based, I have to do a data copy, and more inconveniently, std::vector(in microsoft's implementi) can only copy a element every time. So I have to write a cycle logic to copy the data.

Is there any more convenient type for array mapping in c++?
Reply With Quote
  #2 (permalink)  
Old 04-05-2004
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
No, we only support std::vector. (We could support other mappings with metadata, but at present, we don't have any such other mappings.)

Why can you only copy one element at a time? You can use std::copy(), or even memcpy() to copy several elements. For example:
Code:
int* p = ... // Pointer to ints. 
size_t sz = ... // Number of ints.

std::vector<int> v;
v.resize(sz);

// With std::copy():
std::copy(p, p + sz, v.begin());

// With memcpy():
memcpy(&v[0], p, sz);
Reply With Quote
  #3 (permalink)  
Old 04-05-2004
yomi yomi is offline
Registered User
 
 
Join Date: Aug 2003
Posts: 32
Thanks.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
effects of C++ Array Mapping for Sequences smu Help Center 6 01-12-2007 04:35 PM
Memory problem using dictionary or array as parameters enrico Help Center 6 03-27-2006 12:35 PM
Slice and array??? surfer Help Center 4 11-14-2005 10:11 AM
how to pass binary char array to remote host efficiatively? socketref Help Center 7 09-18-2005 11:15 AM
Type id ganzuoni Comments 5 07-02-2003 04:09 AM


All times are GMT -4. The time now is 09:56 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.