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

Search:

Type: Posts; User: po0ky

Search: Search took 0.01 seconds.

  1. Thread: sizeof fails

    by po0ky
    Replies
    8
    Views
    1,243

    Re: sizeof fails

    Thank you again for both answers.

    Ofcourse its always better to use the library functions, but still I would like to know how these functions work.

    Even in this small code there are always...
  2. Thread: sizeof fails

    by po0ky
    Replies
    8
    Views
    1,243

    Re: sizeof fails

    Thank you for all of your answers. It was very educating. Best way to go would probably be to use strlen.

    Strlen would probably look like something like this?



    int len(const char ar[]) {...
  3. Thread: sizeof fails

    by po0ky
    Replies
    8
    Views
    1,243

    sizeof fails

    #include <iostream>

    int len(const char ar[]) {
    return sizeof(ar)/sizeof(*ar);
    };

    int main(){
    printf("%d",len("124567"));
    std::getchar();
    }
  4. Replies
    11
    Views
    2,773

    Re: Class pointer and vector problem

    Thank you VictorN.

    @McKenzie
    I've given it some thought but I believe you're wrong. The fact is... you don't know all the details about how I'm implementing the class. The sD class isn’t...
  5. Replies
    11
    Views
    2,773

    Re: Class pointer and vector problem

    And i got to check if the pointer is pointing to something before deleting it?
  6. Replies
    11
    Views
    2,773

    Re: Class pointer and vector problem

    I bet one of the things wrong with my code is that I dont initialize my variables?
  7. Replies
    11
    Views
    2,773

    Re: Class pointer and vector problem

    Thank you both for the fast reply...
    Thank you for your answer Philip Nicoletti, it works.

    @Paul McKenzie
    I know I need to check for self-assignment....

    The reason for the new/delete...
  8. Replies
    11
    Views
    2,773

    Class pointer and vector problem

    As the title shows, I find it hard to come up for a good description of the problem I encountered.

    Please can some of you guru's help me?




    #include <vector>

    class sD
  9. Replies
    22
    Views
    2,787

    Re: Selfappending vector

    I think we have a winner. This could probably only be faster if the size of the resulting vector would be hard coded.

    I have read somewhere that lists are faster in sequential processing, but even...
  10. Replies
    22
    Views
    2,787

    Re: Selfappending vector

    How did you know that?


    It's as if you are looking over my shoulder.



    o_0... I gues i'm still a real noob...

    Well I did the timing again, and my god you are right. Cilu's method is...
  11. Replies
    22
    Views
    2,787

    Re: Selfappending vector

    I'm sorry but... thats just awfull, slow and sluggish.
  12. Replies
    22
    Views
    2,787

    Re: Selfappending vector

    There I go blaming the compiler again. Thanks Paul McKenzie I think I understand the problem better now.



    I think this would be a good solution, if not the only solution.
    I'll try it right...
  13. Replies
    22
    Views
    2,787

    Re: Selfappending vector

    No, according to the debugger the vector holds all the items the cout is giving me.

    Pynolathgeen seems to get the expected results.
    Thats why I think its a bug in my compiler.

    @Pynolathgeen...
  14. Replies
    22
    Views
    2,787

    Re: Selfappending vector

    Nope, keep having this problem. Maybe it's my intel atom, or it's because I'm using visual studio 2008.

    However...

    for(;i>0;--i){
    std::string str = strvec[i-1];
    strvec.push_back(str);
    }
    ...
  15. Replies
    22
    Views
    2,787

    Re: Selfappending vector

    Thats even stranger. The origenal program is longer than this example.
    In the original A,B,C and D are "real" strings.
    A for example is X10, B is pauze, C is Y20, D is pauze and E is X-20.

    In my...
  16. Replies
    22
    Views
    2,787

    Selfappending vector

    Hello,

    I've got a strange problem:

    #include <vector>
    #include <iostream>
    #include <string>

    int main(){
    std::vector<std::string> strvec;
Results 1 to 16 of 16





Click Here to Expand Forum to Full Width

Featured