boostorg / container

STL-like containers from Boost
http://www.boost.org/libs/container/
Boost Software License 1.0
101 stars 113 forks source link

basic_string::npos is missing its definition #59

Closed tavianator closed 6 years ago

tavianator commented 6 years ago

Mostly this isn't noticed because it's a constant, but if you take its address (perhaps implicitly through some function that takes parameters by reference) you'll get a link-time error:

$ cat foo.cpp
#include <boost/container/string.hpp>
#include <iostream>

int main() {
  std::cout << &boost::container::string::npos << "\n";
  return 0;
}
$ g++ foo.cpp
foo.cpp:5: error: undefined reference to 'boost::container::basic_string<char, std::char_traits<char>, boost::container::new_allocator<char> >::npos'
collect2: error: ld returned 1 exit status
igaztanaga commented 6 years ago

Thanks for the report!