Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

namespace "std" has no member "sort"

Tags:

c++

sorting

std

Trying to sort an array of Integers and after some googling, came across the solution using std::sort accompanied by this error: namespace "std" has no member "sort".

Just to disqalify any qualms that I'm not using the std namespace, here is my header:

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
like image 546
Binny Zupnick Avatar asked Jan 10 '13 14:01

Binny Zupnick


1 Answers

Add:

#include <algorithm>

as stated in the std::sort() reference page.

See Using std Namespace, Why is "using namespace std" considered bad practice? and many other questions on SO discussing using namespace std;.

like image 116
hmjd Avatar answered Oct 19 '22 01:10

hmjd