CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: Hermit

Page 1 of 24 1 2 3 4

Search: Search took 0.08 seconds.

  1. Re: having trouble writing a recursive algorithm for 2^n

    Just think about it algebraically:

    2^n = 2^(n-1) + 2^(n-1) = 2 * 2^(n-1)
    x(n) = 2^n
    x(n) = 2 * x(n-1)

    Make sense? I haven't written any code and I still feel like I'm giving away the answer.
  2. Replies
    11
    Views
    4,278

    Re: Encryption using a Genetic Algorithm?

    I don't think it's meant to make the key "more secure" with regard to brute force methods, but to make the cyphertext less easily analyzed by mathematical or intuitive means. At the risk of revealing...
  3. Replies
    20
    Views
    2,352

    Re: Size_t Weird Bug within Loop

    A good point. Certainly one could limit the variable's scope with an extra pair of curly braces, but that would be a bit on the ugly side, and not something I can honestly say that I do. I had read...
  4. Replies
    20
    Views
    2,352

    Re: Size_t Weird Bug within Loop

    Agreed that it's odd. If I must write a loop that breaks form like that, I tend to prefer writing it as a while-loop. I don't think anyone should have to take a second look at a for-loop to see what...
  5. Re: Why Non Member Function cannot declared with const ?

    In other words, recall that member functions are implicitly passed a this-pointer when called. When you declare a member function as const, you are specifying the constness of that implicit...
  6. Replies
    24
    Views
    3,793

    Re: Memory Leak Questions

    I don't think it's fair to assume that the OP is still in the beginning stages of his education, so the topic should have little to do with that. If this is a project for an introductory course, I'm...
  7. Replies
    9
    Views
    9,740

    Re: Addressof Unary Functor

    You may want to have a look at boost's ptr_vector class. It will, by default, automatically delete pointers when they are removed from the container.

    Another option would be to use a vector of...
  8. Replies
    9
    Views
    9,740

    Re: Addressof Unary Functor

    None that I'm aware of.
    Seems fine to me. It did seem a bit odd that you would create a second array of pointers to every element in another array, but then I saw the last part of your post. You...
  9. Replies
    12
    Views
    1,378

    Re: self-referencing policies

    This still doesn't make any sense. In order for the policy class to resolve T::fooType, T needs to be a complete type, which it can't be because at this point in the instantiation we're still...
  10. Replies
    65
    Views
    10,523

    Re: Heap efficiency?

    I feel I need to point out that while you criticize _uj for his acerbic posting style, saying that it detracts from the informational content of the thread, you yourself have contributed nothing...
  11. Poll: Re: What void foo() is really? - a Method? OR a Function?

    I would subscribe to Lindley's definition if it lacked the word "objects", which causes it to disagree with the term "static method". To its credit, however, that definition does underscore an...
  12. Replies
    17
    Views
    3,791

    Re: C++ randomizing string help

    You should be aware that the algorithm you're proposing is, in a word, slow. Consider the word "algorithm", of which there are 9! = 36,2880 permutations. Would you want to take each of those...
  13. Replies
    4
    Views
    1,427

    Re: Getting input from Soundcard

    Portaudio is a pretty good cross-platform sound library that you could use. If you're a novice programmer and don't want to muck about with a separate thread for audio, this library is particularly...
  14. Replies
    17
    Views
    2,406

    Re: I need help with this simple calculation!!!

    In the code you posted, you do not divide by div1, you divide by div and store the result in div1. You then output the value of the uninitialized variable divided. Uninitialized variables may...
  15. Replies
    6
    Views
    1,049

    Re: need help with a c++ program :(

    Change
    while (int j=0;j<counter;j++)
    to

    for (int j=0;j<counter;j++)
  16. Replies
    16
    Views
    2,409

    Re: Reference Counting

    This isn't a question.


    Cyclic referencing is partially solved by using weak pointers where appropriate, which are convertible to and from shared pointers but do not by themselves increase the...
  17. Replies
    3
    Views
    1,144

    Re: Uniquely Identifying a PC

    I've seen a few licensing systems use the MAC address of the ethernet adaptor. A quick search brought up this article on getting MAC addresses (Windows-specific).
  18. Replies
    4
    Views
    943

    Re: Memory clear for time testing in c++

    What do you mean by "clear memory"? Free the memory reserved by a vector? One way that's often accomplished is what's called the swap trick:

    std::vector<double> lots_of_data(5000);
    ...
  19. Replies
    6
    Views
    1,110

    Re: GUI Programming In C++?

    Cocoa is an Objective-C framework (could they have picked an uglier language?), although it is possible to incorporate C++ code into a Cocoa application (using "Objective-C++" as its called). Carbon...
  20. Replies
    1
    Views
    6,811

    Finding orthogonal vector

    This is a bit of a math question, but I'll ask it here partly because I don't belong to any math forums, and partly because the computational complexity of the answer is important.

    Given two...
  21. Replies
    3
    Views
    927

    Re: A 'final' C++ class

    Yeah, it's doable. I can't seem to find the article but the technique involves virtually inheriting from a class whose constructor is private and which declares the "final" class as a friend. This...
  22. Replies
    2
    Views
    1,130

    Re: static constant - non integral type

    The problem here is simply that dbar_val is declared const but defined non-const. Change that line to:

    const double bar::dbar_val = 3.1233;
    Note you could also do:

    class bar {
    static...
  23. Replies
    16
    Views
    2,845

    Re: private members not so private.

    The conclusion is that C++ will not keep you from shooting yourself in the foot if you are hell-bent on doing so. Compiler rules exist to keep sane programmers from making mistakes, not to keep...
  24. Re: Template specialisation of template class member function

    Well, it's a debatable point, depending on what kind of guarantee you're looking for. The current standard does not require that strings be contiguous, but future standards will and most if not all...
  25. Re: Template specialisation of template class member function

    I do not think it is safe to assume that all random access iterators will iterate over contiguous memory, just that they provide constant-time access to any element in the collection. If a random...
Results 1 to 25 of 581
Page 1 of 24 1 2 3 4





Click Here to Expand Forum to Full Width

Featured