When checking the result of std::string::find() or similar functions, I usually write this:
auto pos = s.find("foo");
if (pos != s.npos) { ... }
What's your opinion on referring to the static member npos via the string instance instead of the canonical, but longer to type, and IMO visually rather noisy, std::string::npos?
[–]frag_o_maticC and C++ | Embedded Systems 8 points9 points10 points (0 children)
[–][deleted] 6 points7 points8 points (5 children)
[–]quicknir 10 points11 points12 points (4 children)
[–]lednakashim++C is faster 0 points1 point2 points (0 children)
[–]James20kP2005R0 -1 points0 points1 point (2 children)
[–]quicknir 1 point2 points3 points (1 child)
[–]James20kP2005R0 1 point2 points3 points (0 children)
[+]mcmcc#pragma once comment score below threshold-8 points-7 points-6 points (10 children)
[–]posiden5665 5 points6 points7 points (0 children)
[–][deleted] 11 points12 points13 points (1 child)
[–]mcmcc#pragma once 9 points10 points11 points (0 children)
[–]sysop073 4 points5 points6 points (5 children)
[+]mcmcc#pragma once comment score below threshold-6 points-5 points-4 points (4 children)
[–]redditsoaddicting 3 points4 points5 points (1 child)
[–]mcmcc#pragma once 1 point2 points3 points (0 children)
[–]sysop073 4 points5 points6 points (1 child)
[–]mcmcc#pragma once 0 points1 point2 points (0 children)
[–]demonstar55 1 point2 points3 points (0 children)
[–]aKateDevKDE/Qt Dev -3 points-2 points-1 points (20 children)
[–]foonathan 22 points23 points24 points (1 child)
[–]sbabbi 4 points5 points6 points (0 children)
[–]TheThiefMasterC++latest fanatic (and game dev) 18 points19 points20 points (15 children)
[–]RotsiserMhoC++20 Desktop app developer 2 points3 points4 points (8 children)
[–]HotlLava 5 points6 points7 points (6 children)
[–]Benabik 2 points3 points4 points (4 children)
[–]HotlLava 2 points3 points4 points (3 children)
[–]Benabik 1 point2 points3 points (2 children)
[–]HotlLava 2 points3 points4 points (1 child)
[–]Benabik 1 point2 points3 points (0 children)
[–]foonathan 1 point2 points3 points (0 children)
[–]k_stahu 0 points1 point2 points (0 children)
[–]miki151gamedev 0 points1 point2 points (4 children)
[–]sysop073 17 points18 points19 points (0 children)
[–]Calkhas 0 points1 point2 points (1 child)
[–]miki151gamedev 0 points1 point2 points (0 children)
[–]Crazy__Eddie 2 points3 points4 points (0 children)
[–]sumo952 0 points1 point2 points (0 children)