Created
February 5, 2013 20:00
-
-
Save acmorrow/4717154 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In C++11, we can ask for the size of a type for which we don't have an instance: | |
class Tcp6Socket { | |
public: | |
struct SockAddr { ... }; | |
}; | |
char buf[1024]; | |
static_assert(sizeof(buf) >= sizeof(Tcp6Socket::SockAddr)); | |
// Can't do that in C++03, but it works in C++11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment