2014-01-01から1年間の記事一覧

if(cond) と if(cond == true) は同じ意味ではない

C++

if(cond) のコンパイルは通るが、 if(cond == true) と書くとコンパイルが通らない例がある。 struct bool_ { bool value; constexpr explicit operator bool() const noexcept { return value; } }; int main() { bool_ x{true}; if (x == true) { // do so…

データメンバを見ると循環参照してないのに shared_ptr のせいで循環参照になるケース

C++

window.twttr = (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], t = window.twttr || {}; if (d.getElementById(id)) return t; js = d.createElement(s); js.id = id; js.src = "https://platform.twitter.com/widgets.js"; fjs.paren…