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

Search:

Type: Posts; User: GNiewerth

Page 1 of 55 1 2 3 4

Search: Search took 0.07 seconds.

  1. Replies
    27
    Views
    8,404

    Re: Stack/Queue Question

    Correct. But you can typedef them. And you should prefer composition over of private inheritance because a stack isn´t a list.



    template<typename T>
    class StackMio
    {
    public:
    typedef...
  2. Thread: C++ syntax

    by GNiewerth
    Replies
    3
    Views
    818

    Re: C++ syntax

    It´s the ternary operator, it´s syntax is "exp ? A : B". When the exp evaluates to true, its return value is A, else it´s B.
  3. Replies
    9
    Views
    4,216

    Re: vector vs. deque

    I´d like to add that deque has a larger overhead than vector, this can be a serious problem if you need to store huge amounts of data, especially with small data types. At least STLport and...
  4. Replies
    25
    Views
    3,451

    Re: Self deteting EXE

    The easiest way:
    The installer creates a registry entry containing the date of installation (maybe the prgram itself when it´s first run). Upon every start you check the current date against the...
  5. Replies
    25
    Views
    3,451

    Re: Self deteting EXE

    This will fail when the user installs the program, enters the license data and sets the system clock back to 1970...
  6. Replies
    25
    Views
    3,451

    Re: Self deteting EXE

    In conclusion it´s pretty pointless to delete the executable, because you cannot prevent the user from making a backup and running it over and over again. If you want to make sure the program cannot...
  7. Replies
    9
    Views
    1,335

    Re: finding 2 elements in one vector iteration

    Since I don´t know what your data looks like I chose the type T for the data stored in the vector and type U for the find criteria. const is just a promise not to alter the variables during the...
  8. Replies
    25
    Views
    3,451

    Re: Self deteting EXE

    No, it´s impossible for an application to delete its executable (at least on Windows).
    This issue is usually solved by a patcher application, the patcher first checks and performs updates and then...
  9. Replies
    5
    Views
    999

    Re: File size in bytes

    Since you mentioned the Win32 API you might consider GetFileSize or GetFileSizeEx.
  10. Replies
    9
    Views
    1,335

    Re: finding 2 elements in one vector iteration

    Basic approach:



    bool find( const std::vector<T>& v, const U& crit1, const U& crit2 )
    {
    bool found1 = false;
    bool found2 = false;

    for( std::vector<T>::const_iterator it =...
  11. Replies
    3
    Views
    567

    Re: contrasting pointers from non-pointers

    You missed one level of indirection. A pointer is a variable which stores one address, it´s not the address itself. So using the pointer´s "value" means accessing a specific memory location.
    Each...
  12. Replies
    5
    Views
    1,868

    Re: Networking with STL

    No, there aren´t.
  13. Replies
    2
    Views
    542

    Re: Strange memory error

    Instead of using raw C-style arrays for temporary variables you should seriously consider using std::vector instead.
    I took a glance at your code and noticed some strange things:

    - inverseDCT
    1)...
  14. Replies
    20
    Views
    1,750

    Re: [c++]code executon

    Not sure how other compilers deal with that issue, but MS compilers handle the individual expressions in an if clause as sequence points if they&#180;re combined by && or ||. This guarantees that the...
  15. Replies
    6
    Views
    2,164

    Re: Rock, ..., Spock Random Numbers

    I don´t know how my "friends" decided, they´re actually the four guys from the TV Series "The Big Bang Theory". :p
  16. Re: Question about structs in class which wouldn't save value.

    Since copying a std::string object might be expensive changing the ret_b() method to



    const std::string& Sam::ret_b() const
    {
    return b;
    }
  17. Thread: overload

    by GNiewerth
    Replies
    11
    Views
    1,411

    Re: overload

    1) You can eliminate the necessity of a copy constructor/assignment operator by using std::vector instead of a C-style array.

    2) binary operators (i.e. operator+) should be implemented as...
  18. Replies
    6
    Views
    2,164

    Re: Rock, ..., Spock Random Numbers

    Empirical investigations showed that all subjects always chose Spock (at least the four guys I know of), so picking lizard always wins ;)
    What do you think about an algorithm that uses a range of...
  19. Replies
    2
    Views
    1,122

    Re: RAM memory consumption

    If you´re targetting Windows there are two API functions GlobalMemory/GlobalMemoryEx that return the system´s memory statistics.
  20. Replies
    7
    Views
    1,187

    Re: Numbering entries in a data file

    std::map is a container that stores key/value pairs. In this case the key type is an unsigned int (the contact ID) and class Contact (the contact data itself). Basically it looks like a table...
  21. Replies
    7
    Views
    1,187

    Re: Numbering entries in a data file

    Ok, I see. In that case std::map is the container of your choice, because it makes the search for the next free ID much simpler and efficient than std::vector. Please look at this example:


    ...
  22. Replies
    7
    Views
    1,187

    Re: Numbering entries in a data file

    1) Does it make sense to store all your data in memory and occasionally save the whole data? You could perform all changes in RAM and don&#180;t have to bother with fragmentation or holes.
    2) Is it...
  23. Replies
    8
    Views
    1,806

    Re: c++ to launch a program

    You can either omit the batch file at all and follow the approach I advised in my previous approach or specify a window coordinate where the command window cannot be seen. Use the dwX, dwY and...
  24. Replies
    8
    Views
    1,806

    Re: c++ to launch a program

    That cannot be done with C++, you have to use the Win32 API (which should be available since you want to start the target application in Win98 compatibility mode). Your problem can be solved with 3...
  25. Replies
    4
    Views
    869

    Re: choose implementation at link time

    The only solution I can think of are preprocessor conditionals (#ifdef/#else/#elif/#endif), though I seriously don´t recommend using them.
Results 1 to 25 of 1367
Page 1 of 55 1 2 3 4





Click Here to Expand Forum to Full Width

Featured