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

Search:

Type: Posts; User: Philip Nicoletti

Page 1 of 80 1 2 3 4

Search: Search took 0.13 seconds.

  1. Re: Need help allocatig memory for vectorized 2D array

    Just a small point:



    return data[y*xdim+x];


    I believe that is the FORTRAN ordering.
  2. Re: Need help allocatig memory for vectorized 2D array

    The comment in your code mentioned opengl. So pretty much any function that take data with more than one dimension.

    Some examples:

    1) gluBuild2DMipmaps

    2) The ctrlpoints data in the...
  3. Re: Need help allocatig memory for vectorized 2D array

    You have :



    vv2d[0].resize(3); // each set will contain 3 members


    only the first set is resized. Either explicitly resize both vv2d[0] and vv2d[1] or
  4. Replies
    7
    Views
    288

    Re: [RESOLVED] Going through gates

    For those values, it looks like that is optimal. But in the general case, it looks like that algorithm is not necessarily optimal. For an example, see:
    ...
  5. Re: array of numbers sorted in the ascending order

    Are you sure that you copied that function correctly ?
  6. Replies
    4
    Views
    325

    Re: std::find_if problem

    In less I am missing something, none of them should compile. The third parameter to find_if() is wrong in all cases. It should be a predicate.

    1) You have sets with pointers as elements. That...
  7. Replies
    18
    Views
    845

    Re: [RESOLVED] map iterators

    Could you explain this further ?

    Are you saying:



    SomeMapType m1,m2;

    if (m1.end() == m2.end()) // this is possible
    {
  8. Replies
    18
    Views
    845

    Re: map iterators

    I don't think there is a real nice method.

    1) Before reading your "please" comment, I was going to suggest optns.end() [ set after the clear() ]

    2) use a separate bool variable

    3) and...
  9. Re: Copying one bmp file to another using fstream, Access violation reading location

    Something to check:



    ofs_differential.write((char*)&bfh_warm, sizeof(bfh_warm) ); //write header


    What is sizeof(bfh_warm) ? Is it 14, or 16 ?

    Visual C++ has bitmap header structures...
  10. Re: sort vector of objects on member variable

    The bigger function that you supplied will not compile with the sort for result_holder.

    monarch_dodra supplied an example to sort int variables. You would need to change it for variables of type...
  11. Re: sort vector of objects on member variable

    You have:



    bool operator < (const result_holder& lhs, const result_holder& rhs)
    {
    return lhs.row_value > rhs.row_value;
    }
  12. Replies
    10
    Views
    484

    Re: How to do clone in vc++?

    It depends on the object. You need to provide more information .

    1) You might not to add any additional code to a class to copy an object.

    2) You might need to add copy semantics to your...
  13. Re: sort vector of objects on member variable

    If you make operator < a member function, it should only take one argument and be const:



    bool operator < (const result_holder& rhs) const
    {
    return row_value < rhs.row_value;
    }
  14. Replies
    12
    Views
    711

    Re: index position in array Issue

    You have:


    for (int q=0; q=size2;q++)


    This sets q = size2 every time thru the loop (and the loop never terminates)
  15. Re: remove duplicated from sorted vector

    It is not clear how the first two elements are equal. I guess if the second values of the pair are equal ?

    If so...



    #include <algorithm>

    struct EqualWeight
    {
  16. Replies
    6
    Views
    523

    Re: vectors with structure

    You can access using:



    for (vector<SP>::const_iterator it4=it->sl4.begin(); it4!=sl4.end(); ++it4)
    {
    cout << it4->sp1 << " : " << it4->sp2 << "\n";
    }
  17. Replies
    19
    Views
    1,095

    Re: Debugger error - ftol3.asm not found

    from http://www.cplusplus.com/reference/string/string/find/



    size_t find (char c, size_t pos = 0) const noexcept;


    size_t is an unsigned integral type (the same as member type...
  18. Replies
    19
    Views
    1,095

    Re: Debugger error - ftol3.asm not found

    1) you should #include <string>

    2) the type returned by string::find is string::size_type , not double

    3) in general, erasing an element while looping is tricky
  19. Replies
    2
    Views
    464

    Re: crypt a file [algorithm]

    1) You need to open the file as binary. Otherwise, if an EOF character is encountered, input will stop.

    2)


    std::string can handle embedded NULLS.
  20. Re: Run-Time Check Failure #3 - The variable is being used without being initialized

    That is interesting that a run time error occurs in the first example.
    It must occur during the copy when passing x by value. In other
    words, I would guess you would still get the error even if...
  21. Re: How to determine cross platform type during file save?

    Sorry, with further thought my original suggestion would not work.
  22. Re: Need Help with Binary Search Function

    while(high>low and high!=low)


    is legal. There are a number of alternate tokens like this ("bitor" , "xor" , "or" , etc).

    Personally, I would not use them as they are seldom seen in code.
  23. Replies
    11
    Views
    594

    Re: The issues with my piece of code

    1) I was not aware of the "= default" syntax ... good to know

    2) Unless I am missing something, it might be safer to supply them. Section 12.8.10 :



    edit: Upon re-reading the note, I think...
  24. Replies
    11
    Views
    594

    Re: The issues with my piece of code

    Here is an example of a 2D array class using a single vector<T> as a member.
    Element access is done using : arr((i,j) not arr[i][j]

    I added move semantics. You should add move semantics to your...
  25. Replies
    11
    Views
    594

    Re: The issues with my piece of code

    Yes, basically that is correct. Your code in the original post was for a 3D array, so it will call the constructor O(n^2) times.
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 is a CodeGuru survey question.


Featured


HTML5 Development Center