Why is this call to function ambiguous?

SOLVED

I'm testing out a little memory allocator for arrays and my code will not work with the following:

#include <iostream>
using namespace std;

int * allocator(int);

int main()
{
	int size;

	cout << "Enter the size of the array: ";
	cin >> size;

	int * numbers = nullptr;
	numbers = allocator(size);

	for (int x{ 0 }; x < size; ++x) { numbers[x] = x; }
	for (int x{ 0 }; x < size; ++x) { cout << numbers[x] << " "; }


	numbers = nullptr;
	delete[] numbers;

	return 0;
}

int * allocator(int size)
{
	int * temp = nullptr;
	temp = new int[size];
	return temp;
}

It is marking the call to the allocator function as ambiguous. Any ideas why this might be happening would be greatly appreciated.

Posted Aug 12, 2015, 4:49 PM UTC

77
Loading comments…