Click here to Skip to main content
15,919,479 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Get the machine name of the mapped drive C++ Pin
Iain Clarke, Warrior Programmer12-Jan-09 4:03
Iain Clarke, Warrior Programmer12-Jan-09 4:03 
GeneralRe: Get the machine name of the mapped drive C++ Pin
David Crow12-Jan-09 4:25
David Crow12-Jan-09 4:25 
GeneralRe: Get the machine name of the mapped drive C++ Pin
Hamid_RT12-Jan-09 5:12
Hamid_RT12-Jan-09 5:12 
JokeRe: Get the machine name of the mapped drive C++ Pin
Iain Clarke, Warrior Programmer12-Jan-09 5:23
Iain Clarke, Warrior Programmer12-Jan-09 5:23 
JokeRe: Get the machine name of the mapped drive C++ Pin
Rajesh R Subramanian12-Jan-09 5:31
professionalRajesh R Subramanian12-Jan-09 5:31 
GeneralRe: Get the machine name of the mapped drive C++ Pin
Iain Clarke, Warrior Programmer12-Jan-09 5:42
Iain Clarke, Warrior Programmer12-Jan-09 5:42 
QuestionFunction not getting overloaded... Pin
vikram.vit12-Jan-09 2:07
vikram.vit12-Jan-09 2:07 
AnswerRe: Function not getting overloaded... Pin
Stuart Dootson12-Jan-09 4:12
professionalStuart Dootson12-Jan-09 4:12 
Nothing to do with overloading. For both overloads, you're trying to pass a value of type const int * & through a parameter of type int * &. The compiler correctly says that it can't convert a const int * & to a int * & because int * & is less qualified.

Here's one way of altering the code so it compiles:
template<typename Ty>
class sample
{
public:
  typedef Ty& reference;
  typedef Ty* pointer;
  typedef const Ty* const_pointer;
  typedef const Ty& const_reference;


  const_pointer address(const_reference p_data_r) const
  {
    return &p_data_r;
  }

  pointer address(reference p_data_r) const
  {
    return &p_data_r;
  }


};

int main()
{
  sample<int*> sample_obj;
  //Calling address with const pointer
  int* iptr=new int();
  int* const &const_reference=iptr;
  int* const *const_pointer = sample_obj.address(const_reference);
  return 0;
}
The position of const within a type declaration has a significant impact on the type you end up declaring:
  • const int* and int const* both mean pointer to const int - i.e.you can alter the pointer, but not the int it points at.
  • int * const means constant pointer to integer - i.e. you cannot alter the pointer, but you can alter the int it points at.



AnswerRe: Function not getting overloaded... Pin
Rajasekharan Vengalil12-Jan-09 5:14
Rajasekharan Vengalil12-Jan-09 5:14 
Questionnew / delete : when to delted in this regard, Pin
ptr_Electron12-Jan-09 1:55
ptr_Electron12-Jan-09 1:55 
AnswerRe: new / delete : when to delted in this regard, Pin
Cedric Moonen12-Jan-09 2:00
Cedric Moonen12-Jan-09 2:00 
AnswerRe: new / delete : when to delted in this regard, Pin
Rajasekharan Vengalil12-Jan-09 2:01
Rajasekharan Vengalil12-Jan-09 2:01 
GeneralRe: new / delete : when to delted in this regard, Pin
ptr_Electron12-Jan-09 2:10
ptr_Electron12-Jan-09 2:10 
GeneralRe: new / delete : when to delted in this regard, Pin
Cedric Moonen12-Jan-09 2:14
Cedric Moonen12-Jan-09 2:14 
GeneralRe: new / delete : when to delted in this regard, Pin
ptr_Electron12-Jan-09 2:15
ptr_Electron12-Jan-09 2:15 
GeneralRe: new / delete : when to delted in this regard, Pin
Cedric Moonen12-Jan-09 2:26
Cedric Moonen12-Jan-09 2:26 
QuestionXP or Vista style progressbar. Pin
Le@rner12-Jan-09 1:37
Le@rner12-Jan-09 1:37 
QuestionRe: XP or Vista style progressbar. Pin
David Crow12-Jan-09 3:08
David Crow12-Jan-09 3:08 
QuestionMixing managed/unmanaged in C++/CLI Pin
Jon Hulatt12-Jan-09 1:22
Jon Hulatt12-Jan-09 1:22 
NewsRe: Mixing managed/unmanaged in C++/CLI Pin
Iain Clarke, Warrior Programmer12-Jan-09 1:32
Iain Clarke, Warrior Programmer12-Jan-09 1:32 
GeneralRe: Mixing managed/unmanaged in C++/CLI Pin
Jon Hulatt12-Jan-09 1:37
Jon Hulatt12-Jan-09 1:37 
QuestionDialog box LAYOUTRTL issue [modified] Pin
Alex@9C12-Jan-09 1:13
Alex@9C12-Jan-09 1:13 
QuestionGerman ANSI/Unicode umlauts in source code [SOLVED] Pin
sashoalm12-Jan-09 0:59
sashoalm12-Jan-09 0:59 
AnswerRe: German ANSI/Unicode umlauts in source code Pin
Iain Clarke, Warrior Programmer12-Jan-09 1:31
Iain Clarke, Warrior Programmer12-Jan-09 1:31 
GeneralRe: German ANSI/Unicode umlauts in source code Pin
sashoalm12-Jan-09 4:08
sashoalm12-Jan-09 4:08 

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.