|
Im not sure I really follow you and I need to leave the office for the day. have a look at the soufrce for an stl map implementation and see what its doing internally.
|
|
|
|
|
Josh Gray wrote: Yep because each node is allocated individually.
This problem could be potentially solved by using an allocator such as available in the Boost Pool Library[^] library. In particular pool_alloc[^]
Steve
|
|
|
|
|
gluballs wrote: 2) Another problem is the matter of efficiency.
If you are using a binary tree, the average depth would be O(sqrt(N)). If you used a binary search tree instead, the average depth would be O(log N).
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Halo~ I find some difficulties on accessing a .bin file.
I want to read particular bit in a .bin file. I tried to search the solution in the web but still cannot get the solution.
For example, I have a test.bin file which contains the data "1101010101011100". How can I read the 3rd and 4th bit (i.e. "01")?
It would be prefect if anyone can give me a complete source code. Many many thanks to you
Kennis
|
|
|
|
|
Read a byte from the .bin file and by using the bitwise operator (&), required bits can be fetched.
Come online at:-
jubinc@skype
|
|
|
|
|
Is Pointers and references are same, because their assembly language instructions looks the same.
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
They are very similar but not the same. Once you get down to the machine code level that are identical however.
Steve
|
|
|
|
|
Internally reference is implemented as a pointer. The compiler take care about that. That is why the assembly language instructions looks the same. But we u can notify the following differences between a pointer and a reference.
1. a pointer is a variable holding an address of another variable.
2. u can reuse a pointer variable but this is not possible for a reference. or u can assign another address to a pointer variable.
3. u need to use * or -> operator to access the content of a pointer.
4 . there is a possibility of null reference for a pointer, so u need to check like
char *p = new char [MAX_PATH];
.....
.....
if(p)
{
.....do something
}
else
{
do something
}
i think the above will help to understand the things
|
|
|
|
|
I am developing a COM exe using ATL in Visual Studio 2005 .
I have a list control in a ATL dialog however I cannot get it to show any text .
I am adding the code to display some status in the List Control but fail to display anything
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
{<br />
<br />
CAxDialogImpl<catlstatusdlg>::OnInitDialog(uMsg, wParam, lParam, bHandled);<br />
WCHAR str[] = _T("Initialization Done");<br />
SendDlgItemMessage(IDC_LIST1,LB_ADDSTRING , 0 , (LPARAM)&str); bHandled = TRUE;<br />
<br />
<br />
<br />
<br />
<br />
return 1;
}</catlstatusdlg>
Am I missing something here or doing this initialization at the wrong place ?
Help is appreciated
div class="ForumSig">Engineering is the effort !
|
|
|
|
|
act_x wrote: I am adding the code to display some status in the List Control
If you are using list control, LB_ADDSTRING is wrong message to send. LB_ADDSTRING is used to insert item into list box. Use the LVM_INSERTITEM message.
|
|
|
|
|
Hi, I wondering if it is possible to call a main with its parameters from another method?
From the example shown below.
<br />
<br />
int test(int argc, char *argv[])<br />
{<br />
<br />
}<br />
<br />
<br />
void example()<br />
{<br />
test(int argc, char *argv[]);<br />
}<br />
Can can the parameters be altered in the example method which doesn't mean altering the parameter list in the test()?
|
|
|
|
|
It is possible to call the main function from another function. but the
int argc, char *argv[] in example method are local variables of example. u cannot access the int argc, char *argv[] in main from example.
|
|
|
|
|
main is a function hence you can call it from another function (but then you have to find a way to stop recursion).
There isn't main in the posted code.
gman2008 wrote: void example()
{
test(int argc, char *argv[]);
}
The above code is wrong, use, for instance
void example()
{
char * argv[]={"appname", "foo"};
test(2, argv);
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
thanks thats has sorted out the problem
|
|
|
|
|
Ok maybe i'm having a bad day , but for the life of me I can't find any information on how to change the permissions for the 'all users\application data' folder.
During install, I want to install a file to this folder (app.ini). I want to be able to give all users read and write permission to this folder and file. I can get the file installed ok, but it defaults to Read only.
The actual path is:
C:\Documents and Settings\All Users\Application Data\company\appname\app.ini
My installer is MSI that comes with Visual Studio 2005 and I'm using MFC/C++. I may need to create a Custom Action DLL. Not a problem. Just can't figure out how to set the permission of the folder/file to read, write, modify.
Thanks.
|
|
|
|
|
Anyone ever seen this one before? Any hints? We have an app which is producing this error. We get a message box which pops up with this text. The app is native C++/MFC.
|
|
|
|
|
We found the issue. It appears this message is originating from MFC CArchive serialization over a socket when invalid data is sent. So if you see this thats a good area in which to look.
|
|
|
|
|
Since message boxes are modal just breaking the application in a debugger and looking at the call stack should take you straight to the problem.
Steve
|
|
|
|
|
static int* arCombs[6][11] =<br />
{<br />
arCombs[0] = {i1,i2,i3,i4,i5,i6};<br />
arCombs[1] = {i7,i8,i9,i10,i1,i2};<br />
arCombs[2] = {i8,i9,i10,i1,i2,i3};<br />
arCombs[3] = {i9,i10,i1,i2,i3,i4};<br />
arCombs[4] = {i10,i1,i2,i3,i4,i5};<br />
arCombs[5] = {i1,i2,i3,i4,i5,i7};<br />
arCombs[6] = {i1,i2,i3,i4,i7,i8};<br />
arCombs[7] = {i1,i2,i3,i7,i8,i9};<br />
arCombs[8] = {i1,i2,i7,i8,i9,i10};<br />
arCombs[9] = {i1,i6,i7,i8,i9,i10};<br />
arCombs[10] = {i5,i6,i7,i8,i9,i10};<br />
<br />
};
I need to some help about syntax when i wrote this syntax i am giving a bug this like below:
error C2059: syntax error : '{'
Please stop this nonsense offer. I noticed about this offer is a statement against the enemy.
|
|
|
|
|
Have you considered:
static int arCombs[11][6] =
{
{i1,i2,i3,i4,i5,i6},
{i7,i8,i9,i10,i1,i2},
{i8,i9,i10,i1,i2,i3},
{i9,i10,i1,i2,i3,i4},
{i10,i1,i2,i3,i4,i5},
{i1,i2,i3,i4,i5,i7},
{i1,i2,i3,i4,i7,i8},
{i1,i2,i3,i7,i8,i9},
{i1,i2,i7,i8,i9,i10},
{i1,i6,i7,i8,i9,i10},
{i5,i6,i7,i8,i9,i10}
}; BTW, unless you are strictly targeting German-speaking readers, you might want to consider changing your profile to English.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
static int arCombs[11][6] = <br />
{<br />
{i1,i2,i3,i4,i5,i6},<br />
{i7,i8,i9,i10,i1,i2},<br />
{i8,i9,i10,i1,i2,i3},<br />
{i9,i10,i1,i2,i3,i4},<br />
{i10,i1,i2,i3,i4,i5},<br />
{i1,i2,i3,i4,i5,i7},<br />
{i1,i2,i3,i4,i7,i8},<br />
{i1,i2,i3,i7,i8,i9},<br />
{i1,i2,i7,i8,i9,i10},<br />
{i1,i6,i7,i8,i9,i10},<br />
{i5,i6,i7,i8,i9,i10} <br />
};
This is okey thanks..
Please stop this nonsense offer. I noticed about this offer is a statement against the enemy.
|
|
|
|
|
I was about to suggest the code below, but then I've tried it in a compiler and I got an error.
static int arCombs[6][11] =
{
{i1,i2,i3,i4,i5,i6},
{i7,i8,i9,i10,i1,i2},
{i8,i9,i10,i1,i2,i3},
{i9,i10,i1,i2,i3,i4},
{i10,i1,i2,i3,i4,i5},
{i1,i2,i3,i4,i5,i7},
{i1,i2,i3,i4,i7,i8},
{i1,i2,i3,i7,i8,i9},
{i1,i2,i7,i8,i9,i10},
{i1,i6,i7,i8,i9,i10},
{i5,i6,i7,i8,i9,i10}
};
The dimensions are wrong. You are declaring an array of 6 arrays of 11 elements, not an array of 11 arrays of 6 elements. But you only initialize 6 of those 11. The rest get the default value, 0.
So the correct way should be:
static int arCombs[6][11] =
{
{i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
{i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
{i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
{i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
{i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
{i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11}
};
or even
static int arCombs[6][11] =
{
i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11
};
I just copied and pasted the values, but you get the picture
Florin Crisan
|
|
|
|
|
If I use the GDI+ Region::Union(RectF&) method to include 3 GDI+ RectF objects, if I go back and use Region::GetRegionScans(), I don't always get the original 3 rects if there is a simpler way to describe the region. This occurs if two or more connected rects can be described by one larger rect. Is there a way to force the region to preserve the original rects and not simplify the solution to Region::GetRegionScans() or is the simplification inherent in how Regions are stored?
|
|
|
|
|
bob16972 wrote: Is there a way to force the region to preserve the original rects and not simplify the solution to Region::GetRegionScans() or is the simplification inherent in how Regions are stored?
I think the info about original rects is simply discarded.
MSDN [^]states
Region.GetRegionScans Method
Returns an array of RectangleF structures that approximate this Region object.
and the above, IMHO, enforces my hypothesis.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Thanks for taking time out to advise.
|
|
|
|
|