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

Search:

Type: Posts; User: wolle

Page 1 of 19 1 2 3 4

Search: Search took 0.03 seconds.

  1. Replies
    11
    Views
    6,952

    Re: Delete node from BST - iterative

    For an extensive discussion I recommend Advanced Data Structures by Peter Brass. For some reason it's available on the net for free,
    ...
  2. Replies
    2
    Views
    103

    Re: Circular Buffer POP()

    Yet another option you sometimes encounter is this call signature,



    bool try_pop(T& value) { // non-blocking pop


    A variable of type T is passed to try_pop by reference. If try_pop returns...
  3. Replies
    16
    Views
    596

    Re: A question about multi threading.

    I kind of expected that since you reported a speed increase of 3.5 times. It also indicates your code works as expected.



    It's correct but not the only way. Another (complementary) approach is...
  4. Replies
    16
    Views
    596

    Re: A question about multi threading.

    I'm just curious. How many CPU cores do you have?
  5. Replies
    11
    Views
    597

    Re: Palindromes in Python

    At least the TIOBE index is based on objective data and not just what people think,

    https://www.tiobe.com/tiobe-index/

    Here Python has been in a positive trend for quite some time.



    Yes...
  6. Replies
    11
    Views
    597

    Re: Palindromes in Python

    Your "pythonic" versions are quite similar to what a C++ version in the functional style could look like, for example



    inline bool is_palindrome(const std::string& s) {
    return...
  7. Replies
    11
    Views
    597

    Re: Palindromes in Python

    It wasn't meant like that. I know you program in C++ but since you replied here I presume you have Python experience too which I don't have.

    In C++ there's a heavy focus on efficiency (a little...
  8. Replies
    11
    Views
    597

    Re: Palindromes in Python

    My point is that seemingly simple code can have hidden complexities to be aware of. Your suggestion in #3 is an example of that. It may be that it doesn't matter in this case (who's ever written a...
  9. Replies
    11
    Views
    597

    Re: Palindromes in Python

    Your solution may have a lower complexity in some elegance sense but the algorithmic complexity is higher than necessary because the string is always reversed (as far as I can tell without knowing...
  10. Re: C or C++ equivalent to Java 2D graphics functionality

    Neither do I :). I've been in too many of those during my Java days.

    I just wanted to balance your imperative statement that "If the target OS is Windows, the best choice is Direct2D libray". It...
  11. Re: C or C++ equivalent to Java 2D graphics functionality

    Just because the target is Windows doen't necessarily mean the best choise is to use Direct2D. It may still be better to use a portable 2D package. Chances are this package will use Direct2D anyway...
  12. Replies
    2
    Views
    515

    Re: How to solve java.lang.NullPointerException

    Maybe it's because you declare buttonarray but never assign an array object to it?

    You could try,



    private JButton[] buttonarray = new JButton[12];


    to check out whether that's the...
  13. Re: C or C++ equivalent to Java 2D graphics functionality

    C++ itself doesn't supply a 2D graphics library although some think there should be one,

    http://open-std.org/JTC1/SC22/WG21/docs/papers/2017/p0669r0.pdf

    Instead C++ programmers must look...
  14. Re: Reducing numbers to one digit (numerology related)

    This problem is called the digital root. It's presented here including the closed formula solution,

    https://en.wikipedia.org/wiki/Digital_root
  15. Thread: use pointer

    by wolle
    Replies
    4
    Views
    313

    Re: use pointer

    Here's a video that explains (some of) the different ways to pass parameters to a function.

    https://www.youtube.com/watch?v=TgsH02sORZ0

    Note that just because something is possible doesn't mean...
  16. Replies
    6
    Views
    330

    Re: trancate fonction

    Or the problem was stuck with you! :)

    You can avoid truncation altogether by only writing exactly what you want on the file in the first place.
  17. Replies
    6
    Views
    330

    Re: trancate fonction

    The truncate function doesn't seem to belong to the C++ standard but I found a description here,

    https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/trunc.htm
    ...
  18. Replies
    1
    Views
    329

    Re: Visual Studio C++ projects with UI

    Strange. The whole idea with C++/CLI was that legacy C++ code should work with .NET. Did you select "mixed mode" in the project settings? It should allow you to mix native and managed code in the...
  19. Replies
    2
    Views
    410

    Re: Data Structures book

    I like Advanced Data Structures by Peter Brass. I see it's coming soon in a (relatively) cheap paperback version but the book is also available on the internet for free,
    ...
  20. Replies
    13
    Views
    1,626

    Re: How to learn c++/cli?

    C++ also has spiked, or at least recovered somewhat from the falling trend it shares with most major languages. I like to think it's the modernization effort in recent years that is finally paying...
  21. Re: What is the difference between procedural and object-oriented programs? Write sim

    I'd like to clarify my post #3.

    The key difference is the class concept available in OO languages. It allows programmers and library providers to define new types. To see how this works, let's...
  22. Thread: struct to vector

    by wolle
    Replies
    14
    Views
    590

    Re: struct to vector

    It's item 41 in Effective Modern C++ right?

    The string passing case is an example that ends with a general advice and that's to consider pass by value under certain circumstances. Then Meyers...
  23. Thread: struct to vector

    by wolle
    Replies
    14
    Views
    590

    Re: struct to vector

    Move semantics was introduced to make copying cheaper and this is important because C++ traditionally prefers it over so called reference semantics (that many other languages prefer such as say...
  24. Thread: struct to vector

    by wolle
    Replies
    14
    Views
    590

    Re: struct to vector

    Not that it matters much but the OP could still use the temp variable as two temporary ints in a call to emplace_back(). It would look like this,



    pp.emplace_back(temp.x, temp.y).


    This...
  25. Thread: struct to vector

    by wolle
    Replies
    14
    Views
    590

    Re: struct to vector

    It does and I'd say the copy constructor gets called twice. The code is equivalent to doing,


    vector<point> pp = {temp};


    The curly brackets {} mean that first an initializer list containing...
Results 1 to 25 of 461
Page 1 of 19 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)