[Bug c++/14422] New: GCC wont recognize mem_fun1_ref

tron dot thomas at verizon dot net gcc-bugzilla@gcc.gnu.org
Wed Mar 3 23:44:00 GMT 2004


I receive the error:
`mem_fun1_ref' undeclared in namespace `std'

When compiling the following code:

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

class Value
{
public:
	Value(int nValue) : m_nValue(nValue) {}
	
	void Change(int nValue) { std::cout << (m_nValue *= nValue) << "\n"; }

private:
	int m_nValue;
};

int main()
{
	std::vector<Value> values;
	values.push_back(Value(1));
	values.push_back(Value(2));
	values.push_back(Value(3));
	values.push_back(Value(4));
	values.push_back(Value(5));

	std::for_each(values.begin(), values.end(),
		std::bind2nd(std::mem_fun1_ref(&Value::Change), 2));
	
	return 0;
}

This code compiles and runs successfully when built with the Borland compiler

-- 
           Summary: GCC wont recognize mem_fun1_ref
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tron dot thomas at verizon dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14422



More information about the Gcc-bugs mailing list