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

Search:

Type: Posts; User: superbonzo

Page 1 of 54 1 2 3 4

Search: Search took 0.06 seconds.

  1. Re: compiler error with function to sort vector of objects on member variable value

    and here is a (less generic) c++03 version:



    template < typename T, typename V >
    struct greater_by_comparator
    {
    greater_by_comparator( V T::*member ): member_(member){}

    ...
  2. Re: compiler error with function to sort vector of objects on member variable value

    just the naming seems a bit misleading ( dispersion_object_sort suggests a sorting function at first sight; dispersion_object_comparator may sound better ... )



    sure you can(*), not so sure...
  3. Replies
    32
    Views
    1,223

    Re: stl map of vectors

    in my ( personal ) experience, descriptive and truth-telling names are far more important than anything else. Moreover, I'd have serious problems working with a programmer that finds std algorithms...
  4. Replies
    32
    Views
    1,223

    Re: stl map of vectors

    there are many of them ( the code above is essentially boost.range ); I think the most advanced design to date is Niebler's range v3 but I don't think it's ready for inclusion in the std. If I had to...
  5. Replies
    32
    Views
    1,223

    Re: stl map of vectors

    I vote for #3 as it makes the intent instantaneously clear ( no need to ask yourself what's going on in the loops ) and fluent ( as long as you read it correctly )



    auto sPDN = std::find_if(...
  6. Replies
    25
    Views
    19,120

    Re: Relationship is-a, has-a and uses-a

    there's nothing wrong in *reading* a 9 years old thread nor referencing to it somehow, of course

    it's just that you'll get a cleaner and more focused discussion if you open a new thread for each...
  7. Re: Android, native shared libraries, and symbol stripping

    never done myself, but can't you parse Proguard (non obfuscated) output and obtain the "shrinked" JNI headers ? these could be used to create an .so that is statically linked ( and hence size...
  8. Replies
    25
    Views
    19,120

    Re: Relationship is-a, has-a and uses-a

    I'm not assuming anything; you said to be a newbie, you proved to be a newbie and you did a common newbie mistake, that is to try learning OO principles via simplistic analogies and false...
  9. Replies
    25
    Views
    19,120

    Re: Relationship is-a, has-a and uses-a

    sorry if I expressed myself badly, I didn't claim that OO is overrated. I claimed that the pedagogical approach ( common in some academic circles ) assuming that "the principles of object oriented...
  10. Replies
    25
    Views
    19,120

    Re: Relationship is-a, has-a and uses-a

    you're probably reversing causes and effects: you struggle to grasp abstract notions *because* you don't appreciate code, not the other way around :)

    it's perfectly normal ( and even healthy I'd...
  11. Replies
    7
    Views
    497

    Re: Would this cause a link time error?

    I know I'm nitpicking :) but



    in theory, it could; the compiler could "mark" the static as shared among tu's and let the linker strip off the duplicates ( as it does with the weak symbols...
  12. Replies
    7
    Views
    497

    Re: Would this cause a link time error?

    actually, I was referring to your original post ( that you edited later ) where the static B member of A was accessed from B's own constructor ... that was very awkward :)

    your current code is...
  13. Replies
    7
    Views
    497

    Re: Would this cause a link time error?

    design awkwardness aside(*), yes, static members should be defined somewhere (**) ... usually, this is done in A's cpp file:



    // A.cpp

    B A::b; // assuming a default constructor


    (*) at a...
  14. Replies
    10
    Views
    436

    Re: casting smart pointer

    ... amazing :(

    I'm still convinced this is a severe quality of implementation issue, there's no excuse the compiler doesn't check such a simple compile time ( and critical ) precondition ( I...
  15. Replies
    10
    Views
    436

    Re: casting smart pointer

    sorry, but unless you have some corner cases I missed in mind, things like the following



    void* p;
    std::shared_ptr<void> s(p);


    should give a compiler error on any sane minded...
  16. Replies
    10
    Views
    436

    Re: casting smart pointer

    (almost *) no, that cannot occur because the deleter ( however obtained ) always needs a complete type, so passing a bare void* should not work; (*) almost, because a compiler could still omit to...
  17. Replies
    10
    Views
    436

    Re: casting smart pointer

    no, std::shared_ptr<void> is not void*; std::shared_ptr<void> works perfectly well as far as lifetime management is concerned ( deletion works via a type-erased deleter that knows the type of the...
  18. Replies
    10
    Views
    436

    Re: casting smart pointer

    alternatively ( and to keep the code more readable ) you can directly cast the get() pointer up to a temporary reference, as long as you're sure that _data is not empty ( as it seems from your code...
  19. Replies
    25
    Views
    19,120

    Re: Relationship is-a, has-a and uses-a

    not quite, being a private member it's irrilevant from an interface design pov. Even if it were publicly observable, the fact that you have a member of some type T does not imply a valid has-a-T...
  20. Re: Recursive function: take a non-negative integer and print each digit of that inte

    well, then I have to ask you what do you mean exactly by equivalent/different solutions. Note that the issue this thread is about ( well, at least concerning OReubens and tiliavirga debate ) has to...
  21. Re: Recursive function: take a non-negative integer and print each digit of that inte

    yep, and I was pointing out that you have'nt proved that an explicit stack is required in the OP case ( the fact that it's not tail recursive does not imply it , unless I'm missing something of...
  22. Re: Recursive function: take a non-negative integer and print each digit of that inte

    granted, an explicit stack is the most straightforward way of transforming a recursive solution to an interative solution, but I don't think it's "required" ( unless you consider any form of state an...
  23. Re: Recursive function: take a non-negative integer and print each digit of that inte

    consider the number "123456"

    123456 % 10 = 6
    123456 / 10 = 12345
    12345 % 10 = 5
    12345 / 10 = 1234
    1234 % 10 = 4
    1234 / 10 = 123
    ...
  24. Re: Find all sentences or consecutive sequence of sentences where min

    wait, do they mean that eol's can be in the middle of a sentence ? if yes, the inplace parsing can be further simplified by using a deque and char by char extraction ...
  25. Re: Find all sentences or consecutive sequence of sentences where min

    assuming this is c++ and we can use only the standard lib, something like ( off the top of my head, neither compiled nor tested ! )



    #include <string>
    #include <vector>
    #include <fstream>...
Results 1 to 25 of 1329
Page 1 of 54 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a Codeguru.com survey!


HTML5 Development Center