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

Search:

Type: Posts; User: monarch_dodra

Page 1 of 80 1 2 3 4

Search: Search took 0.07 seconds.

  1. Replies
    2
    Views
    89

    Re: Template specialisation error

    Alternatively, you could use something such as function_traits to extract the arguments of your function pointer directly.
  2. Replies
    2
    Views
    89

    Re: Template specialisation error

    The issue is that you can only use "(void)" at syntax level, for C compatibility. But inside templates, you are way past that phase, and the compiler will not accept passing the *actual* void type.
    ...
  3. Replies
    1
    Views
    129

    Re: Generate Unique Ids

    Why not just use UUIDs?

    The advantage of UUID is there is no need to try to track consistency. You don't have to worry about threads, races, or multiple machines generating ids.

    Either that, or...
  4. Re: Read and write std::vector through stream

    As you wrote, you can read and write to a binary stream via the read and write functions.

    Just iterate over the vector, and write all elements 1 by 1. Same thing for reading back: just insert the...
  5. Re: memory alloc, access and release by 3 different functions

    Or alternatively, just return the pointer:



    unsigned short *alloc_mem()
    {
    unsigned short *input = (unsigned short *)calloc(SIZE, sizeof(unsigned short));
    input[0]=0xAABB;...
  6. Re: Add the ability to Search And Delete , in this AVL tree code

    If you don't store the height of a subtree in their corresponding root node, you are going to have catastrophic (insertion) performance. Right now, the calculation of the tree's height is O(n) where...
  7. Re: What will happen if I brutally force to stop an application when ptrs are smart

    Typically, everything is "freed", but not necessarily "cleanly". Files may not be flushed, temporary lock files may not be deleted, termination signals may not be sent etc...
  8. Replies
    11
    Views
    468

    Re: Some serious error

    I wouldn't really agree. When an allocation fails, there isn't really anything you can do about it most of the time, and are usually better off just letting the exception propagate.

    In particular,...
  9. Re: How to avoid an empty entry when an empty slot is found?

    Not to rant or anything, but you are close to 900 threads here over a span of 6 years. Surely you should know how to use a map by now? It's a super basic question, and one you've already asked too:...
  10. Re: How to avoid an empty entry when an empty slot is found?

    +1 for find



    auto it = window.find(currentWindow);
    if (it != window.end()) {
    ...
    }
  11. Re: Genetic Algorithm - Crossover and MPI

    MPI is Message Passing Interface. It's a way of doing "multithreading" where threads communicate by sending messages to each other. Usually, these threads do not share any memory at all, which means...
  12. Replies
    20
    Views
    623

    Re: eof not working properly?

    FWIW, I've found that the issue with not using getline is that it often (wrongly) succeeds with badly structured files. You 'll sometimes end up reading data from multiple lines at once and/or...
  13. Replies
    20
    Views
    1,069

    Re: Sparse Matrix Operations

    I believe the original goal was to get this working for sparse matrix implementations?
  14. Replies
    4
    Views
    638

    Re: (Array Swapping Elements) Game Help

    Debugger depends a lot on what IDE you are using. But most IDEs have debugging integrated and work pretty much the same way. You first click on a line number, which will set a little red dot there,...
  15. Replies
    2
    Views
    371

    Re: Returning a smart pointer by value?

    This is the correct way to do it. Your pointer indeed gets trashed, but that's OK, since you are also returning a copy, so your reference count does not drop to 0 (unless your compiler implements...
  16. Re: Why is my struct destructor not called???

    If the double free/delete don't get you first ;)
  17. Re: How do I complete my code to shift array elements to the right?

    This approach creates binary bloat, and increases compile times. What you want to do is merely use the template interface to forward to a non-template interface.

    But even then, things like c++17's...
  18. Re: How do I complete my code to shift array elements to the right?

    you have non-matching signatures:
    void rightShiftElements (int arr[], int N);
    vs
    void rightShiftElements (int arr[], int N, int M)

    Also, you are calling it with the wrong name:
    shiftright(...
  19. Re: How to make a short form of copy constructor in the inherited class?

    No, that's wrong. That's A's (copy) constructor's job. By the time B's copy constructor is running, A is fully built and initialized. B cannot initialize A's fields.

    The only thing B's copy...
  20. Re: Appending Node to Doubly Linked List

    Also, just looked at your code again: One of the main points of a doubly linked list is backwards iteration and being able to access the last element easily. You should NOT be walking your list to...
  21. Re: Appending Node to Doubly Linked List

    I'd suggest you start by having a Node constructor that at the very least initializes your fields for you (especially the pointers). Better yet, use C++11's member initialiser.

    Anyways, a "pro...
  22. Replies
    2
    Views
    396

    Re: So Slow to clear an unordered map.

    hash_combine does hashing of whatever it is passed, so
    hash_combine(seed, k.x); should be fine.

    Regarding your original question: How exactly are you clearing the map, and how are you populating...
  23. Re: How to have a statement run in global scope in C++

    This is not accurate. mem_ob is not a "member object". It is just a local object that will be destroyed at the end of the scope of the constructor. What you want is:


    class MemTr {
    private:...
  24. Replies
    3
    Views
    467

    Re: Out of memory problem

    Wait, you were declaring your table on the stack !? That would never work in a million year. Your table alone would be about 300MB, and a stack is usually no bigger than 1-4 MB. You might have more...
  25. Replies
    17
    Views
    1,540

    Re: How to distribute a value into vector

    Again, you can just add 1 to every value. Also, the code provided has "int minimum = 1; // included" explicitly provided. Did you decide to stop reading after the first sentence?


    I'm not sure my...
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


HTML5 Development Center