[Discuss] SemiOT - Question for the C++ gurus

pw p.willis at telus.net
Mon Mar 5 10:56:27 PST 2007


pw wrote:
> Adam Parkin wrote:
>> pw wrote:
>>> Is this your homework............?
>>
>> Well if you consider a C++ wrapper class for the GNU C Readline 
>> library routines to be (hopefully) eventually used in your grad 
>> supervisors research work to be homework, then yes, it is. =;->
>>
>>>       ///should set this to a default array value
>>>       static std::vector<std::string> m_vec;
>>>
>>>       myvec(std::vector<std::string> vecIn = m_vec):privVec(vecIn){ }
>>
>> Is that the only way though, to create a separate "dummy" vector?
>>
>> Thanks....
> 
> 
> You could also set m_vec to a value before instantiation
> as an external variable or constant.
> 
> ie:
> 
> 
> ////namespace required(???)
> 
> std::string blah[]={"a","b","c","yada"};
> size_t sz = sizeof blah / sizeof *blah;

This bothered me.
I believe a namespace is required here:

ie:

namespace
{
	std::string blah[]={"a","b","c","yada"};
	size_t sz = sizeof blah / sizeof *blah;
}



Peter





More information about the Discuss mailing list