text: Q:
  
  std::vector sort() on Linux?
  
  I've got a program that I'm writing on Windows where I use the sort function of std::vector. It works fine, but when I compile on Linux, I get an error that says:
  'sort' was not declared in this scope
  Is there some Linux-friendly version of sort that I need to use?
  class Bigun {
  private:
      std::vector<Other*> others;
  };
  
  void Bigun::sortThoseOthers() {
      sort(others.begin(), others.end(), compareOthers);
  }
  
  A:
  
  There is no function sort in std::vector on either platform, so I presume you are using std::sort with an iterator range from an std::vector.
  This is fine and correct.
  The error message suggests two things:
  
  You're writing sort, not std::sort. That will work as long as you wrote using namespace std, though using the fully-qualified name is better. Moving on.
  You did not write #include <algorithm>, instead relying on "transitive includes" — that is, assuming some other header itself includes <algorithm>, which may well be the case by chance with the Visual Studio implementation, but not with libstdc++ or libc++.
  You should always include the proper standard header to guarantee portability. Don't skimp on includes just because your program appears to work without them on some specific system.
  Do that here and I bet your problem will go away.
  
  In general, barring problems with standard compliance and/or toolchain bugs, standard features are identical across operating systems. That's why they're standard.
  #include <vector>
  #include <algorithm>
  #include <iostream>
  
  int main()
  {
      std::vector<int> v{5,3,4,1,2};
      std::sort(v.begin(), v.end());
  
      for (const auto& el : v)
         std::cout << el << ' ';
      std::cout << '\n';
  }
  
  // Output: 1 2 3 4 5
  
  (live demo, on Linux)
  
  