
Software engineer and indie hacker. Former VPR&D at Seemplicity. AI ๐ค Sec ๐ค Dev
- Tweets379
- Following268
- Followers51
- Likes1.2K

ALT #include <type_traits> // std::is_same_v #include <utility> // contains constrained std::swap // Comment/uncomment this to see the difference: using namespace std; namespace _detail { struct okay {}; struct swap_returns_okay_only_if_no_using_std {}; // just something that's always going to be a worse match // for swap than the movable-constrained one in the standard // library. template <class T, class U> okay swap(T, U const&); } template <class T=_detail::swap_returns_okay_only_if_no_using_std> inline constexpr auto detect_using_namespace_std = !std::is_same_v< decltype(swap(std::declval<T&>(), std::declval<T&>())), _detail::okay>; static_assert( !detect_using_namespace_std<>, "Don't include my header file after a `using namespace std`!" );














![>>> cat main.cpp int buf[10]; buf[12] = 0;](https://pbs.twimg.com/media/EyyXAX7WUAcFDB8.png?name=small&format=webp)










