|
Tim Smith wrote:
I know I really over state my position a LOT.
Yeah, not like me at all. Oh, wait.... :P
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
LOL - and I really mean it too.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
actually, LOSLISTC - Laughed out so loud I scared the cats.
I looked down and they were both looking up... "What the hell is wrong with you????"
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Christian Graus wrote:
use str("") to clear it,
reduced from 5 ms to 4 ms. Anyway, cannot compete with a char buffer. As Tim and you pointed out, my obsession with using STL in all situations caused this problem. I should have realized (as I have now) earlier that a high efficiency loop requires optimization and not generic classes.
In fact, initially I was having another thread of discussion with Tim about hash_map (because i did not suspect ostringstream, until I profiled it). Actually hash_map works great and the hash function which I copied from the CMapStringToString in MFC gives me virtually 0 collissions for my data set.
Anyway, I learned that I should not assume anything about a problem.
Thanks a lot for the insight you guys give. I have definitely become a much better programmer and designer with the interactions that I have at CP.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Can somebody show me how do I implement in my view the event on item expanding using a CTreeViewCtrl derived class.
Thanks
|
|
|
|
|
VC++ would have been a better forum for this question. More people who may know the answer to this question hang out there.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
The main reason of asking this in this forum, was because I found that the message handling of the events is handled in diferent ways. So the way is handled in MFC projects is not the same as in WTL projects.
So I rather be asking this to people of this forum because my project is an WTL/ATL project.
|
|
|
|
|
hellooo ppl.. long time since I ventured to codeproject..
anyway... I've been facing this problem..
I have an activex dll written in vb that exposes a few methods..like
public function fn1(byval x a integer, byval y as integer) as integer
fn1 = x + y
end function
I want to use this in my mfc/ atl project... I used #import to import the dll and as vb exposes a smart pointer to my interface.. I used it to call my method... but I get a runtime error when the pointer is being created...
I would like to know the low-down on using components developed in vb.. is it possible to use them without using automation ..if yes how do I go about creating a custom no automation iterface in vb!
thks guys
One more addition to the addiction of coding!
If you want a helping hand, you'll find one at the end of your arm.
|
|
|
|
|
How exactly are you creating the instance of your COM object?
Are you (error checking and handling omitted):
_MyObjectPtr pPtr("MyProject.MyObject");
pPtr->fn1(...);
or
_MyObjectPtr pPtr;
pPtr.CreateInstance(__uuidof(_MyObject));
pPtr->fn1(...);
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
Ok, given IID I can load the library....
And If I am given the path -> LoadTypeLib(Path) loads the library (perfect).
Is there any way when given IID discover dll, or exe server path/filename????
Thanks,
Brian
|
|
|
|
|
Never mind QueryPathOfRegTypeLib
|
|
|
|
|
What's the best way to stream a container?
inline std::ostream& operator<<(std::ostream& out, const MyClass& s)
{
return out << s.m_SomeVar;
}
MyClass myClass;
std::cout << myClass;
how do I do the same but with a vector of MyClass?
std::vector<MyClass> myClasses;
std::cout << myClasses;
use for_each maybe?
std::for_each(m_PopProfiles.begin(), m_PopProfiles.end(), Something<std::cout>()); ??
Todd Smith
|
|
|
|
|
I found this on a web site. I am sure someone with a clue can post a better solution:
copy (l.begin(), l.end(), ostream_iterator(cout, ""));
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Just what I needed. Thanks!
Todd Smith
|
|
|
|
|
Hi.
I would like to debug a simple algorithm that does not work using an STL solution. The solution works via iteration.
std::list<unsigned int=""> theList;
for (unsigned int i = 0; i < 10; ++i)
theList.push_back(i);
// theList should now contain 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
// Remove "6" from the list.
// Assume that iTheList is an iterator that points to element with value 6.
theList.erase(iTheList);
// After erase() theList should now contain 0, 1, 2, 3, 4, 5, 7, 8, and 9.
Okay. Everything above works as designed. Now I would like to decrement everything bigger or equal to "6," thus make theList hold 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Here is the iterative solution.
-----
// Given iTheList points to theList.begin().
while (*iTheList <= 6)
++iTheList
// Now decrement until end of theList.
while (*iTheList != theList.end()
{
*iTheList = *iTheList - 1;
++iTheList;
}
-----
The iterative solution above works perfect.
I would like to implement a more efficient and elegant solution. Here is one solution using STL algorithms. However, it does not work correctly.
-----
std::for_each(std::find_if(theList.begin(), theList.end(), std::bind2nd(std::greater<>, 6)), theList.end(), std::bind2nd(std::minus<>, 1));
-----
The STL solution above does not work. The logic and syntec seem to be valid.
Is there a logic or syntec misunderstanding in the STL solution? I looked over the function objects and function adapter. They are valid.
Thanks,
KUphryn
|
|
|
|
|
Why are you trying to replace simple code with a god awful stream of unreadable syntax that you have to work hard to actually get to work? That isn't programming, that is STL masturbation.
Stick with the simple solution. Of course, these days that isn't the politically correct answer.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I see your point.
Kuphryn
|
|
|
|
|
The problem is your find_if
What will find_if return in the following case? It will return an interator pointing to the beginning of the list which is the same as l.begin(). So it pretty much infinite loops.
std::find_if(l.begin(), l.end(), std::bind2nd(std::less<int>(), 100));
<b>Todd Smith</b>
|
|
|
|
|
Okay. Thanks.
Fruny posted a solution at GameDev using transform().
http://www.gamedev.net/community/fo...topic_id=120974
Kuphryn
|
|
|
|
|
|
hahahahah
Yeah, I believe the STL is exceptionally powerful if the software engineer knows it well.
Kuphryn
|
|
|
|
|
I'll be a good boy and avoid more of my anti-STL rant. But I really do like the containers. Well, mostly even though I have found the ATL7 containers to produce smaller code with less syntactical mess.
But yes, I do like STL containers. I think...
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
But yes, I do like STL containers. I think...
Yes you do, because you have realized the power of the dark side. Muhahahaha.
--
Master, I'm so glad to feel your presence. But you don't seem to share my impatience. I relied upon you to break the silence. I cannot understand your reluctance.
Master, I feel so warm and I'm so happy, oh master.
Give me some more of the warm little beasts
I'm so fond of.
|
|
|
|
|
Since I am always interested in finding out if the STL method actually performs better, I love to test this stuff. There have been many cases where STL is faster. But this is another of many more cases where the "right" way isn't the faster way.
Base line, add ten elements and then clear: 40,813 MS
STL Method supplied by Funny and then clear: 40,781 MS
The "EVIL" hand written loop and then clear: 39,547 MS
At least this wasn't as bad as Scott Meyer's example in his "Why STL loops are better than hand written loops" article where HIS example ran 3 times slower than the handwritten loop.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I left some extra code in the base line test. The real numbers are:
Base line, add ten elements and then clear: 38,843 MS
STL Method supplied by Funny and then clear: 40,157 MS
The "EVIL" hand written loop and then clear: 39,281 MS
These numbers seemed to be stable between multiple tests. The relationship was always maintained.
STL way added 1,314ms to the total time.
Hand written loop added 438ms to the total time.
Which means that the STL way is 3 times slower than the hand written loop. Even if you toss in 100 ms here and there for timing error, STL is still much slower.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|