Click here to Skip to main content
15,891,184 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Positioning in file Pin
Michael Dunn11-Sep-06 8:42
sitebuilderMichael Dunn11-Sep-06 8:42 
GeneralRe: Positioning in file Pin
Monin D.11-Sep-06 9:24
Monin D.11-Sep-06 9:24 
AnswerRe: Positioning in file Pin
mostafa_pasha11-Sep-06 9:41
mostafa_pasha11-Sep-06 9:41 
QuestionSeprating client area in MDI application. Pin
mostafa_pasha11-Sep-06 8:20
mostafa_pasha11-Sep-06 8:20 
GeneralRe: Seprating client area in MDI application. Pin
Jun Du11-Sep-06 8:57
Jun Du11-Sep-06 8:57 
GeneralRe: Seprating client area in MDI application. Pin
mostafa_pasha11-Sep-06 9:23
mostafa_pasha11-Sep-06 9:23 
GeneralRe: Seprating client area in MDI application. Pin
Jun Du12-Sep-06 2:33
Jun Du12-Sep-06 2:33 
QuestionProblem Overloading operator new in a template class Pin
JKallen11-Sep-06 7:50
JKallen11-Sep-06 7:50 
I am over-riding operator new [] so that when an array of "Objects" is created they contain information about adjacent items in the array. I am getting the following error....
c:\Visual Studio Projects\JLib\main.cpp(149): error C2661: 'Object<T>::operator new[]' : no overloaded function takes 3 arguments

The following code results in the above comilation error.

Object<double>* objects;
objects = new Object<double>[5]; // <- error occurrs here
delete [] objects;

If anyone knows what is going on I would very much appreciate an explanation.

Here is the relevant declarations and definitions...

#pragma once
#include <new>

using namespace std;

template <typename T> class Object{
public:
//CONSTRUCTORS ETC ETC ETC

void* operator new[](size_t size) throw(bad_alloc);
void* operator new[](size_t size,const nothrow_t&) throw();
void operator delete[](void* ptr) throw();
void operator delete[](void* ptr,const nothrow_t&) throw();

//OTHER STUF

};

template <typename T> void* Object<T>::operator new[](size_t size) throw(bad_alloc){
Object<T>* data = 0;
if ( (data = ::operator new[](size){
//ommitted for brevity
}
return data;
}

template <typename T> void* Object<T>::operator new[](size_t size,const nothrow_t&) throw(){
Object<T>* data = 0;
if ( (data = ::operator new[](size,const nothrow_t&)) ){
//ommitted for brevity
}
return data;
}

template <typename T> void Object<T>::operator delete[](void* ptr) throw(){
::operator delete [] (ptr);
ptr = 0;
}

template <typename T> void Object<T>::operator delete[](void* ptr,const nothrow_t&) throw(){
::operator delete [] (ptr,const nothrow_t&);
ptr = 0;
}
AnswerRe: Problem Overloading operator new in a template class Pin
Zac Howland11-Sep-06 8:33
Zac Howland11-Sep-06 8:33 
QuestionProblems reading from a text file Pin
KaKa'11-Sep-06 7:24
KaKa'11-Sep-06 7:24 
AnswerRe: Problems reading from a text file Pin
Zac Howland11-Sep-06 7:27
Zac Howland11-Sep-06 7:27 
QuestionReading from file -- readline problem: Pin
gunner_uk200011-Sep-06 6:32
gunner_uk200011-Sep-06 6:32 
AnswerRe: Reading from file -- readline problem: Pin
Zac Howland11-Sep-06 7:25
Zac Howland11-Sep-06 7:25 
Questionreading from a text file Pin
FredrickNorge11-Sep-06 5:10
FredrickNorge11-Sep-06 5:10 
AnswerRe: reading from a text file Pin
Zac Howland11-Sep-06 5:22
Zac Howland11-Sep-06 5:22 
GeneralRe: reading from a text file Pin
FredrickNorge11-Sep-06 5:38
FredrickNorge11-Sep-06 5:38 
Questiondifference between TRUE and true Pin
Tara1411-Sep-06 5:03
Tara1411-Sep-06 5:03 
AnswerRe: difference between TRUE and true Pin
Sarath C11-Sep-06 5:15
Sarath C11-Sep-06 5:15 
AnswerRe: difference between TRUE and true Pin
Chris Losinger11-Sep-06 5:15
professionalChris Losinger11-Sep-06 5:15 
AnswerRe: difference between TRUE and true Pin
Zac Howland11-Sep-06 5:17
Zac Howland11-Sep-06 5:17 
AnswerRe: difference between TRUE and true Pin
toxcct11-Sep-06 5:19
toxcct11-Sep-06 5:19 
AnswerRe: difference between TRUE and true Pin
Michael Dunn11-Sep-06 7:34
sitebuilderMichael Dunn11-Sep-06 7:34 
GeneralRe: difference between TRUE and true Pin
Tara1411-Sep-06 8:44
Tara1411-Sep-06 8:44 
GeneralRe: difference between TRUE and true Pin
Nish Nishant11-Sep-06 8:51
sitebuilderNish Nishant11-Sep-06 8:51 
GeneralRe: difference between TRUE and true Pin
Michael Dunn11-Sep-06 8:51
sitebuilderMichael Dunn11-Sep-06 8:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.