function declaration with default parameter


, I am trying to declare a function that takes a std::list parameter. I want this function to have an empty list as a default parameter. It's a template function also. Currently i am stuck because my compiler does ...
Posted On: Monday 26th of November 2012 12:46:31 AM Total Views:  282
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




Template and function pointer question

This is my first post here, please tell me if I did anything wrong. in the following code snippet: 1. template 2. In find_if(In begin, In end, Pred f) { 3. while (begin != end && ...
VIEWS ON THIS POST

164

Posted on:

Sunday 25th November 2012
View Replies!

pointer to a member function?

Hi everybody, I was wondering if there is an easy solution to this problem in order to avoid writing some extra code: I have a template class that has a member function called map: template class Q { ...
VIEWS ON THIS POST

121

Posted on:

Sunday 25th November 2012
View Replies!

Implicit conversion from function pointer to std::nested_function

The most recent (N2413) lambda proposal provides some rationale on why a common representation for all <&>-form lambdas, in form of std::nested_function type, is a good idea. I agree wholeheartedly - if this part is accepted, std::nested_function could conceivably replace ...
VIEWS ON THIS POST

123

Posted on:

Sunday 25th November 2012
View Replies!

tr1::function implementation

About two years ago I came across somebody's public implementation of the tr1::function (and tr1::result_of) on the web. It was much more straightforward than the GNU or Boost version (it only allowed up to 2 arguments). It helped me learn ...
VIEWS ON THIS POST

126

Posted on:

Sunday 25th November 2012
View Replies!

function object design problem

Suppose there is some complex functor, and we are using some helper functions inside: class Func { private: inline void helper(...) {...} public: RetType operator()(const &data, Type1 param1, Type2 param2, ...) { const Type1 precomputed_param1 = some_heavy_math(param1, ...); ... ... ...
VIEWS ON THIS POST

142

Posted on:

Sunday 25th November 2012
View Replies!

how to return 2 instances of the same user-defined class from a function

i have a class "myClass", and i want to return two instances of the same class from a function. I define an array as follows : "myClass sample[2] ;" and i initialize two instances: "myClass sample1, sample2 ;" "sample[0] ...
VIEWS ON THIS POST

185

Posted on:

Sunday 25th November 2012
View Replies!

member functions and implicit "this"

this is from C++ Primer 4/e page 260: there is a class named Sales_item and same_isbn is a member function of that class. bool same_isbn(const sales_item &rhs) const { return isbn == rhs.isbn; } author says the word const modifies ...
VIEWS ON THIS POST

137

Posted on:

Sunday 25th November 2012
View Replies!

Address of a member function

hi, I searched in the groups here but didnt find any post answering my question. My question is I need the address of the member function in the same class. Is there anyway to go about it other than making ...
VIEWS ON THIS POST

117

Posted on:

Monday 26th November 2012
View Replies!

recursiveness on template member function of a template class

Hi all, I am trying to do that, but it does not compile. I am not even sure this is possible. I have read somewhere that specialization inside a template class is not without specializing the class itself, but couldn't ...
VIEWS ON THIS POST

209

Posted on:

Monday 26th November 2012
View Replies!

About the retrogression problem when passing a array variable into a function which takes a pointer as its argument.

folks, As the Subject suggests, array variable will retrogress as the parameter of the function actually taking pointer as its argument, like this: int f(int* i) { cout << sizeof(i) << endl; return 0; } main() { int a[100]; ...
VIEWS ON THIS POST

181

Posted on:

Monday 26th November 2012
View Replies!

Handling daylight savings with standard time functions?

Is there any way to make time-of-day adjustments for daylight savings using only standard time functions We have a program that executes daily at a fixed time of day. After daylight savings happens, the time-of-day alignment is lost. For ...
VIEWS ON THIS POST

105

Posted on:

Monday 26th November 2012
View Replies!

extensible math functions: variable number of arguments and class templates

I have a couple of questions about using a variable number of arguments in a function call (...). The context is that I have some mathematical functions I created. I currently pass them a pair of numbers (doubles), and the ...
VIEWS ON THIS POST

209

Posted on:

Monday 26th November 2012
View Replies!

"Overloading" a metafunction

all, In my generic Visitors implementation, I have defined a policy type (which determines how I traverse the structure to be visited) as a meta-function of the type of the visitor and the type of the visited structure's node: ...
VIEWS ON THIS POST

122

Posted on:

Monday 26th November 2012
View Replies!

partially specializing member functions of a template class

Is there a way to partially specialize only a member function of a template class (not the whole class). e.g. template class Base { public: void fun (int key ) {cout<<"inside the template class\n"; } ...
VIEWS ON THIS POST

164

Posted on:

Monday 26th November 2012
View Replies!

Template member function specialization question

I have a (non-templated) class that has a templated member function. I wish to specialize this function in one particular case but run into a problem. I have put code below that shows this problem, if you un-comment the ...
VIEWS ON THIS POST

154

Posted on:

Monday 26th November 2012
View Replies!

inline virtual functions

Dear experts, A virtual function has to have an address. So if an inline virtual function is actually inlined then in that case what does address of this function signify How does compiler know at compile time about the actual ...
VIEWS ON THIS POST

133

Posted on:

Monday 26th November 2012
View Replies!

Returning more than one value from a function

is pair<> fine for returning two values What about more than two values PS: Values may be of different types. Opinions Thank you Mohit...
VIEWS ON THIS POST

156

Posted on:

Monday 26th November 2012
View Replies!

is a char array created in a function local?

, If a function that returns an array of char like this one: const char* f(){ return "abc"; } then is the char array "abc" local/temporary object I thought it should be temporary and hence the returned pointer should point ...
VIEWS ON THIS POST

157

Posted on:

Monday 26th November 2012
View Replies!

Vectorization of template functions

all, I am attempting to vectorize few template functions with the Intel compiler, but without much success so far. Ok granted, this question is not 100% c++, but it is related enough that I felt I could post it ...
VIEWS ON THIS POST

105

Posted on:

Monday 26th November 2012
View Replies!

Object oriented callbacks and differences in member vs non-member function pointers

I have great respect for the contributors of this newsgroup and have a question that I can't seem to find an answer for, I need to understand if it there is anything in the C++ standard that prevents or ...
VIEWS ON THIS POST

415

Posted on:

Monday 26th November 2012
View Replies!