Uli Kusterer (Not a kitteh)<p>Say, is there a trick in C++ to make to_string() work for any type?</p><p>If I have</p><p>using namespace std;</p><p>and then just write</p><p>to_string(foo)</p><p>it will prefer my local namespace's to_string(MyClass) and error when given an int, instead of picking std::to_string(int) for those.</p><p>Do I really have to add all variants of</p><p>inline string to_string(int n) { return std::to_string(n); }</p><p>to my namespace to be able to just say to_string(foo) for any type and make it work?</p><p><a href="https://chaos.social/tags/CPlusPlus" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CPlusPlus</span></a> <a href="https://chaos.social/tags/CPP" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CPP</span></a> <a href="https://chaos.social/tags/CXX" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CXX</span></a> <a href="https://chaos.social/tags/programming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>programming</span></a></p>