Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

NotFredSafe

NotFredSafe NotFredSafe

Niner since 2010

  • STL11: Magic && Secrets

    At 35:12, you start talking about move semantics in the context of the flip function taking a string by value, but there are no move semantics involved here. Since the arguments are const char arrays, the string variable s is simply initialized by the constructor string(const char*), as it always has been.

  • Interactive Panel: The Importance of Being Native

    # Now let's consider insertions for the vector in detail. What you do is simply allocating a new chunk of memory with n+1 space and traversing the original vector, copying all elements into the new chunk. All of this costs O(n)

    Allocating n+1 space is a common beginner's mistake which would indeed lead to O(n) push_back performance. In reality, the complexity of push_back is "amortized constant time", because the space is not increased by a fixed addend like +1 or +10 but rather by a fixed factor like *1.5 or *2.

    I'm a bit surprised STL did not comment on this since. Unless I'm mistaken, this issue is one of his pet peeves Smiley

  • YOW 2012 Keynotes and Session Videos Now Available

    Nice! Download links would be very nice.

  • Talkin' C++ with Kate Gregory

    How about an E2E on C++0x with Kate and Stephan? Smiley

  • C9 Lectures: Stephan T Lavavej - Advanced STL, 2 of n

    Discussing terminology is often futile. For example, most C++ programmers say that "a pointer is a variable that stores an address", which is completely wrong. Should I go around correcting these people all the time? No. It is common vocabulary that you simply cannot eradicate anymore. As long as everybody understands what you're talking about, there's no problem. We all know that, at least in the context of these videos, STL means "the part of the standard library that is based upon the ideas of containers, algorithms and iterators".

    (In case you're wondering, despite its name, the unary prefix operator & does not yield an address, but a pointer. The correct way to say it would be "a pointer variable is a variable that stores a pointer", which is quite obvious, so you won't hear it uttered very often.)

  • C9 Lectures: Stephan T Lavavej - Advanced STL, 2 of n

    @44:22 Casting to void* would be unwise, because you cannot do pointer arithmetic on void pointers Wink

  • C9 Lectures: Stephan T Lavavej - Advanced STL, 1 of n

    std::vector allocates bytes, not arrays. It doesn't internally do a "new ClassType[size]"; it just calls the allocator and asks for a block of memory with a size of "sizeof(ClassType) * size". When it adds an entry, it first constructs that piece of memory by calling a placement new, then issues the copy/move constructor.

    Yes, I know. That's why I said "used to wonder" and later mentioned placement new.

  • C9 Lectures: Stephan T Lavavej - Advanced STL, 1 of n

    Here is something I used to wonder for a long time. It is impossible to create an array of a user-define type that has no default constructor (unless you explicitly initialize all elements via the array-initalizer, of course). How does std::vector pull it off even though it uses an array internally? So if it's not too trivial, you could talk about placement new and explicit destructor calls. (This would be a perfect place to discuss various memory management and object lifetime details/issues.)

    Also, I would love to see a guide through the implementation of unordered_set, provided there is any interesting "magic" going on.

    I guess <initializer_list> is not practical to talk about yet due to lack of support in VC, right?

     

  • C9 Lectures: Stephan T. Lavavej - Standard Template Library (STL), 10 of 10

    STL said

    Today I only have my laptop to show you code. You'll be spared my horrible scribblings on the whiteboard this time.

    I miss your "horrible scribblings" Wink When will the new series start? Can't wait!

  • C9 Lectures: Stephan T. Lavavej - Standard Template Library (STL), 10 of 10

    Stephan, any news on the upcoming advanced STL series? Really looking forward to watching it Smiley

See more comments…