I have to admit, I was quite shocked to see how many lines of code are required to transfer one C struct with MPI.
Under what circumstances will it work to simply transmit a struct using the predefined dataype MPI_CHAR? Consider the following example:
struct particle {
double x;
double y;
long i;
};
struct particle p;
MPI_...
What difference there is when you access to another struct by value or by a pointer?
When should be used each one of them?
type foo_ struct {
st uint8
nd uint8
}
type bar struct {
rd uint8
foo foo_
}
type barP struct {
rd uint8
foo *foo_
}
...
I have a model class for which it makes quite a lot of sense to have NSSize and NSPoint instance variables. This is lovely.
I'm trying to create an editing interface for this object. I'd like to bind to size.width and whatnot. This, of course, doesn't work.
What's the cleanest, most Cocoa-y solution to this problem? Of course I could w...
I've got a C# function that converts a byte array to a class, given it's type:
IntPtr buffer = Marshal.AllocHGlobal(rawsize);
Marshal.Copy(data, 0, buffer, rawsize);
object result = Marshal.PtrToStructure(buffer, type);
Marshal.FreeHGlobal(buffer);
I use sequential structs:
[StructLayout(LayoutKind.Sequential)]
public new class Packe...
In a project I'm writing code for, I have a void pointer, "implementation", which is a member of a "Hash_map" struct, and points to an "Array_hash_map" struct. The concepts behind this project are not very realistic, but bear with me. The specifications of the project ask that I cast the void pointer "implementation" to an "Array_hash_ma...
public struct Items
{
public string Id;
public string Name;
}
public Items[] _items = null;
if (_items.Contains("Table"))
{
// i need to check the structure and need to return correponding id
}
and am having a list of variables in my structure variable...
i need to sea...
Hi,
I have a structure with the following definition:
typedef struct myStruct{
int a;
char* c;
int f;
} OBJECT;
I am able to populate this object and write it to a file. However I am not able to read the char* c value in it...while trying to read it, it gives me a segmentation fault error. Is there anything wrong with my ...
The question is about the structs. When I declare a struct type variable/object (don't know which one suits better) or an array or list of structs, do I have to call the constructor explicitly like objects or just declaring will suffice like variables?
...
Is there a way to clone an existing struct with different member alignment in Visual C++?
Here is the background:
I use an 3rd-party library, which defines several structs. To fill up the structs, I pass the address of the struct instances to some functions. Unfortunately, the functions only returns unaligned buffer, so that data of so...
As you may know, the wall rect will not update since its a copy and not a reference. Is there a way for me to make a reference or pointer to r and not change this code? I suppose i could do a find/replace in the function but that something i try not to do.
//code to get wall
var r = wall.r;
//more code
r.Height += yDif;
...
How to differentiate between overloading the 2 versions of operator ++ ?
const T& operator ++(const T& rhs)
which one?
i++;
++i;
...
I have the following struct declaration and typedef in my code:
struct blockHeaderStruct {
bool allocated;
unsigned int length;
};
typedef struct blockHeaderStruct blockHeader;
When I do sizeof(blockheader), I get the value of 4 bytes back, but when I do sizeof(blockHeaderStruct), I get 8 bytes.
Why is this happening? Why am ...
Hello all ,
How to fix the size of the combo box (contents may be larger but the combo size should be fixed).Now my combo size is changed based on the items in the combo.
I'm trying to get something similar to the yahoo sign up page security Question combo:
https://edit.yahoo.com/registration?.src=fpctx&.intl=in&.done=http://i...
struct ptr{
int node;
ptr *next;
ptr(){}
ptr(int _node, ptr *_next){ node=_node; next=_next; }
};
struct list_t{
ptr *sht;
int size;
void push(int node){
size++;
sht=new ptr(node,sht);
}
}shthead[100001], comp[200001], tree[200001];
The struct ptr is a smart pointer, be used as a linked l...
I have a custom struct :
struct A
{
public int y;
}
a custom class with empty constuctor:
class B
{
public A a;
public B()
{
}
}
and here is the main:
static void Main(string[] args)
{
B b = new B();
b.a.y = 5;//No runtime errors!
Console.WriteLine(b.a.y);
}
When I run the above program, it does ...
I wrote a bunch of code and i would like to fix it the fastest way possible. I'll describe my problem in a easier way.
I have apples and oranges, they are both Point and in the list apples, oranges. I create a PictureBox and draw the apple/oranges on screen and move them around and update the Point via Tag.
The problem now is since its...
Hi guys, I haven't coded in C++ in ages. And recently, I'm trying to work on something
involving structs. Like this
typedef struct{
int x;
int y;
} Point;
Then in a loop, I'm trying to create new structs and put pointers to them them in a list.
Point* p;
int i, j;
while (condition){
// compute values for i and j with som...
How can I initilise a structure in the constructor list?
Say:
struct St{int x, y};
class Foo
{
public:
Foo(int a = 0, int b = 0) : /*here initilise st_foo out of a and b*/
{}
private:
const St st_foo;
};
...
My question is easily summarized as: "Why does the following not work?"
teststruct = struct('a',3,'b',5,'c',9)
fields = fieldnames(teststruct)
for i=1:numel(fields)
fields(i)
teststruct.(fields(i))
end
output:
ans = 'a'
??? Argument to dynamic structure reference must evaluate to a valid field name.
Especially since teststru...
I have a problem about Linked Lists. I already know how to create structures and linked list. But now I have to create arbitrary number of linked list which are also be kept in another structure. Which means :
struct list{int x, struct list *next; };
struct parent{int x, struct list *head, struct parent *next;}
And after lists are...