Polymorphism in template functionsExtending std::to_string to support enums and pointersWhy can templates only be implemented in the header file?Where and why do I have to put the “template” and “typename” keywords?Why does an overridden function in the derived class hide other overloads of the base class?what's polymorphic type in C++?How to call a template member function in a template base class?Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognitiontypeid for polymorphic pointers?C++ Unexpected behaviour of polymorphic cloningUnderstanding polymorphism in C++Function template argument deduction (class vs funtion template)
Why will we fail creating a self sustaining off world colony?
Would skyscrapers tip over if people fell sideways?
Listen to my Story...Let us find the Unique Invisible Pan Digital Pair
Is it advisable to inform the CEO about his brother accessing his office?
How useful would a hydroelectric power plant be in the post-apocalypse world?
Why do movie directors use brown tint on Mexico cities?
Why doesn't SpaceX land boosters in Africa?
English idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)
Dynamic Sql Query - how to add an int to the code?
Active wildlife outside the window- Good or Bad for Cat psychology?
How do I keep a running total of data in a column in Excel?
Hard for me to understand one tip written in "The as-if rule" of cppreference
Copy group of files (Filename*) to backup (Filename*.bak)
Fast method to cut/shred glue stick into small pieces
Why is exile often an intermediate step?
Does friction always oppose motion?
What prevents a US state from colonizing a smaller state?
Why am I getting an electric shock from the water in my hot tub?
Could all three Gorgons turn people to stone, or just Medusa?
Does a lens with a bigger max. aperture focus faster than a lens with a smaller max. aperture?
A* pathfinding algorithm too slow
Why were the first airplanes "backwards"?
Tricolour nonogram
Sort a list of lists by increasing order of elements
Polymorphism in template functions
Extending std::to_string to support enums and pointersWhy can templates only be implemented in the header file?Where and why do I have to put the “template” and “typename” keywords?Why does an overridden function in the derived class hide other overloads of the base class?what's polymorphic type in C++?How to call a template member function in a template base class?Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognitiontypeid for polymorphic pointers?C++ Unexpected behaviour of polymorphic cloningUnderstanding polymorphism in C++Function template argument deduction (class vs funtion template)
I want to use template function for handling both polymorphic and non-polymorphic classes. Here are 3 basic classes.
class NotDerived
;
class Base
public:
virtual ~Base()
void base_method()
;
class Derived : public Base
;
Since NotDerived has no virtual functions, I can't use dynamic_cast, next comes template function:
template<class T>
auto foo(T& some_instance)
if (std::is_base_of_v<Base, T>)
//CASE_1: Works for d and b
/*some_instance.base_method();*/
//CASE_2: Works for d and b
/*auto lamb1 = [](T& some_instance) some_instance.base_method(); ;
lamb1(some_instance);*/
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ;
lamb2(some_instance);
The main functions does this:
void main()
Derived d;
Base b;
NotDerived nd;
foo(d);
foo(b);
foo(nd);
Now I understand why CASE_1 does not work in case of passing nd
variable, but what I can't understand is that I have to explicitly cast some_instance
in lamb2 function in order to call base_method.
Can someone explain why CASE_1, CASE_2 do not work, while CASE_3 works.
By working I mean calling base_method if possible without dynamic_casting.
Also is it possible to use constexpr
for handling such cases of static polymorphism or compiled polymorphism(Hope it is legal to name it like this)
c++ templates polymorphism
add a comment |
I want to use template function for handling both polymorphic and non-polymorphic classes. Here are 3 basic classes.
class NotDerived
;
class Base
public:
virtual ~Base()
void base_method()
;
class Derived : public Base
;
Since NotDerived has no virtual functions, I can't use dynamic_cast, next comes template function:
template<class T>
auto foo(T& some_instance)
if (std::is_base_of_v<Base, T>)
//CASE_1: Works for d and b
/*some_instance.base_method();*/
//CASE_2: Works for d and b
/*auto lamb1 = [](T& some_instance) some_instance.base_method(); ;
lamb1(some_instance);*/
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ;
lamb2(some_instance);
The main functions does this:
void main()
Derived d;
Base b;
NotDerived nd;
foo(d);
foo(b);
foo(nd);
Now I understand why CASE_1 does not work in case of passing nd
variable, but what I can't understand is that I have to explicitly cast some_instance
in lamb2 function in order to call base_method.
Can someone explain why CASE_1, CASE_2 do not work, while CASE_3 works.
By working I mean calling base_method if possible without dynamic_casting.
Also is it possible to use constexpr
for handling such cases of static polymorphism or compiled polymorphism(Hope it is legal to name it like this)
c++ templates polymorphism
I dont want to call base_method from nd. I want to pass variables into template function, and let template function decide whether to call base_method or pass
– Demaunt
Mar 25 at 16:05
oh sorry, I misread your code, my fault ;)
– formerlyknownas_463035818
Mar 25 at 16:17
add a comment |
I want to use template function for handling both polymorphic and non-polymorphic classes. Here are 3 basic classes.
class NotDerived
;
class Base
public:
virtual ~Base()
void base_method()
;
class Derived : public Base
;
Since NotDerived has no virtual functions, I can't use dynamic_cast, next comes template function:
template<class T>
auto foo(T& some_instance)
if (std::is_base_of_v<Base, T>)
//CASE_1: Works for d and b
/*some_instance.base_method();*/
//CASE_2: Works for d and b
/*auto lamb1 = [](T& some_instance) some_instance.base_method(); ;
lamb1(some_instance);*/
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ;
lamb2(some_instance);
The main functions does this:
void main()
Derived d;
Base b;
NotDerived nd;
foo(d);
foo(b);
foo(nd);
Now I understand why CASE_1 does not work in case of passing nd
variable, but what I can't understand is that I have to explicitly cast some_instance
in lamb2 function in order to call base_method.
Can someone explain why CASE_1, CASE_2 do not work, while CASE_3 works.
By working I mean calling base_method if possible without dynamic_casting.
Also is it possible to use constexpr
for handling such cases of static polymorphism or compiled polymorphism(Hope it is legal to name it like this)
c++ templates polymorphism
I want to use template function for handling both polymorphic and non-polymorphic classes. Here are 3 basic classes.
class NotDerived
;
class Base
public:
virtual ~Base()
void base_method()
;
class Derived : public Base
;
Since NotDerived has no virtual functions, I can't use dynamic_cast, next comes template function:
template<class T>
auto foo(T& some_instance)
if (std::is_base_of_v<Base, T>)
//CASE_1: Works for d and b
/*some_instance.base_method();*/
//CASE_2: Works for d and b
/*auto lamb1 = [](T& some_instance) some_instance.base_method(); ;
lamb1(some_instance);*/
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ;
lamb2(some_instance);
The main functions does this:
void main()
Derived d;
Base b;
NotDerived nd;
foo(d);
foo(b);
foo(nd);
Now I understand why CASE_1 does not work in case of passing nd
variable, but what I can't understand is that I have to explicitly cast some_instance
in lamb2 function in order to call base_method.
Can someone explain why CASE_1, CASE_2 do not work, while CASE_3 works.
By working I mean calling base_method if possible without dynamic_casting.
Also is it possible to use constexpr
for handling such cases of static polymorphism or compiled polymorphism(Hope it is legal to name it like this)
c++ templates polymorphism
c++ templates polymorphism
edited Mar 25 at 16:02
NathanOliver
107k19 gold badges159 silver badges236 bronze badges
107k19 gold badges159 silver badges236 bronze badges
asked Mar 25 at 15:49
DemauntDemaunt
3834 silver badges15 bronze badges
3834 silver badges15 bronze badges
I dont want to call base_method from nd. I want to pass variables into template function, and let template function decide whether to call base_method or pass
– Demaunt
Mar 25 at 16:05
oh sorry, I misread your code, my fault ;)
– formerlyknownas_463035818
Mar 25 at 16:17
add a comment |
I dont want to call base_method from nd. I want to pass variables into template function, and let template function decide whether to call base_method or pass
– Demaunt
Mar 25 at 16:05
oh sorry, I misread your code, my fault ;)
– formerlyknownas_463035818
Mar 25 at 16:17
I dont want to call base_method from nd. I want to pass variables into template function, and let template function decide whether to call base_method or pass
– Demaunt
Mar 25 at 16:05
I dont want to call base_method from nd. I want to pass variables into template function, and let template function decide whether to call base_method or pass
– Demaunt
Mar 25 at 16:05
oh sorry, I misread your code, my fault ;)
– formerlyknownas_463035818
Mar 25 at 16:17
oh sorry, I misread your code, my fault ;)
– formerlyknownas_463035818
Mar 25 at 16:17
add a comment |
2 Answers
2
active
oldest
votes
Case 3 does not work. You are casting to an unrelated type and using that temporary to call the function which is undefined behavior.
The problem with using
if (std::is_base_of_v<Base, T>)
//...
is that everything in the ...
part needs to be able to compile. What you need is a way to only call that code when T
is the type you want. You can use constexpr if like
if constexpr (std::is_base_of_v<Base, T>)
some_instance.base_method();
else
// do something else since T isn't a Base or derived from Base
And now if std::is_base_of_v<Base, T>
is false then some_instance.base_method();
will be discarded and never compiled.
Case_3 works, because it compiles, but does not call base_method. My goal is not to call base_method from nd, I just want template function to decide whether to call base_method
– Demaunt
Mar 25 at 16:04
@Demauntauto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ; lamb2(some_instance);
does callbase_method
, which is UB sincend
is not derived fromBase
.
– NathanOliver
Mar 25 at 16:06
add a comment |
You should take a look into the official doc about SFINAE. The code inside your if will get compiled in any case, so that's why it wont compile.
If you are using C++17, you can replace it with a constexpr if, that will evaluate the information inside the if during compilation time and ignore the code if needed:
template<class T>
auto foo(T& some_instance)
if constepxr (std::is_base_of_v<Base, T>)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
else
// Whatever you want to do
If you are using an older version of C++ a simple function overload may solve your problem:
template<class T>
auto foo(T& some_instance)
// Do whatever
auto foo(Base& some_instance)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
As an alternative, you can use SFINAE mechanism to peek the right function by using std::enable_if
:
template <typename T>
typename std::enable_if<std::is_base_of<Base, T>::value, void>::type
foo()
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
template <typename T>
typename std::enable_if<!std::is_base_of<Base, T>::value, void>::type
foo()
// Do whatever
2
Your second example is not a specialization, it is an overload. It also wont work if a derived class is passed since the template will produce an exact match.
– NathanOliver
Mar 25 at 16:01
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341631%2fpolymorphism-in-template-functions%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Case 3 does not work. You are casting to an unrelated type and using that temporary to call the function which is undefined behavior.
The problem with using
if (std::is_base_of_v<Base, T>)
//...
is that everything in the ...
part needs to be able to compile. What you need is a way to only call that code when T
is the type you want. You can use constexpr if like
if constexpr (std::is_base_of_v<Base, T>)
some_instance.base_method();
else
// do something else since T isn't a Base or derived from Base
And now if std::is_base_of_v<Base, T>
is false then some_instance.base_method();
will be discarded and never compiled.
Case_3 works, because it compiles, but does not call base_method. My goal is not to call base_method from nd, I just want template function to decide whether to call base_method
– Demaunt
Mar 25 at 16:04
@Demauntauto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ; lamb2(some_instance);
does callbase_method
, which is UB sincend
is not derived fromBase
.
– NathanOliver
Mar 25 at 16:06
add a comment |
Case 3 does not work. You are casting to an unrelated type and using that temporary to call the function which is undefined behavior.
The problem with using
if (std::is_base_of_v<Base, T>)
//...
is that everything in the ...
part needs to be able to compile. What you need is a way to only call that code when T
is the type you want. You can use constexpr if like
if constexpr (std::is_base_of_v<Base, T>)
some_instance.base_method();
else
// do something else since T isn't a Base or derived from Base
And now if std::is_base_of_v<Base, T>
is false then some_instance.base_method();
will be discarded and never compiled.
Case_3 works, because it compiles, but does not call base_method. My goal is not to call base_method from nd, I just want template function to decide whether to call base_method
– Demaunt
Mar 25 at 16:04
@Demauntauto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ; lamb2(some_instance);
does callbase_method
, which is UB sincend
is not derived fromBase
.
– NathanOliver
Mar 25 at 16:06
add a comment |
Case 3 does not work. You are casting to an unrelated type and using that temporary to call the function which is undefined behavior.
The problem with using
if (std::is_base_of_v<Base, T>)
//...
is that everything in the ...
part needs to be able to compile. What you need is a way to only call that code when T
is the type you want. You can use constexpr if like
if constexpr (std::is_base_of_v<Base, T>)
some_instance.base_method();
else
// do something else since T isn't a Base or derived from Base
And now if std::is_base_of_v<Base, T>
is false then some_instance.base_method();
will be discarded and never compiled.
Case 3 does not work. You are casting to an unrelated type and using that temporary to call the function which is undefined behavior.
The problem with using
if (std::is_base_of_v<Base, T>)
//...
is that everything in the ...
part needs to be able to compile. What you need is a way to only call that code when T
is the type you want. You can use constexpr if like
if constexpr (std::is_base_of_v<Base, T>)
some_instance.base_method();
else
// do something else since T isn't a Base or derived from Base
And now if std::is_base_of_v<Base, T>
is false then some_instance.base_method();
will be discarded and never compiled.
answered Mar 25 at 15:57
NathanOliverNathanOliver
107k19 gold badges159 silver badges236 bronze badges
107k19 gold badges159 silver badges236 bronze badges
Case_3 works, because it compiles, but does not call base_method. My goal is not to call base_method from nd, I just want template function to decide whether to call base_method
– Demaunt
Mar 25 at 16:04
@Demauntauto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ; lamb2(some_instance);
does callbase_method
, which is UB sincend
is not derived fromBase
.
– NathanOliver
Mar 25 at 16:06
add a comment |
Case_3 works, because it compiles, but does not call base_method. My goal is not to call base_method from nd, I just want template function to decide whether to call base_method
– Demaunt
Mar 25 at 16:04
@Demauntauto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ; lamb2(some_instance);
does callbase_method
, which is UB sincend
is not derived fromBase
.
– NathanOliver
Mar 25 at 16:06
Case_3 works, because it compiles, but does not call base_method. My goal is not to call base_method from nd, I just want template function to decide whether to call base_method
– Demaunt
Mar 25 at 16:04
Case_3 works, because it compiles, but does not call base_method. My goal is not to call base_method from nd, I just want template function to decide whether to call base_method
– Demaunt
Mar 25 at 16:04
@Demaunt
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ; lamb2(some_instance);
does call base_method
, which is UB since nd
is not derived from Base
.– NathanOliver
Mar 25 at 16:06
@Demaunt
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method(); ; lamb2(some_instance);
does call base_method
, which is UB since nd
is not derived from Base
.– NathanOliver
Mar 25 at 16:06
add a comment |
You should take a look into the official doc about SFINAE. The code inside your if will get compiled in any case, so that's why it wont compile.
If you are using C++17, you can replace it with a constexpr if, that will evaluate the information inside the if during compilation time and ignore the code if needed:
template<class T>
auto foo(T& some_instance)
if constepxr (std::is_base_of_v<Base, T>)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
else
// Whatever you want to do
If you are using an older version of C++ a simple function overload may solve your problem:
template<class T>
auto foo(T& some_instance)
// Do whatever
auto foo(Base& some_instance)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
As an alternative, you can use SFINAE mechanism to peek the right function by using std::enable_if
:
template <typename T>
typename std::enable_if<std::is_base_of<Base, T>::value, void>::type
foo()
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
template <typename T>
typename std::enable_if<!std::is_base_of<Base, T>::value, void>::type
foo()
// Do whatever
2
Your second example is not a specialization, it is an overload. It also wont work if a derived class is passed since the template will produce an exact match.
– NathanOliver
Mar 25 at 16:01
add a comment |
You should take a look into the official doc about SFINAE. The code inside your if will get compiled in any case, so that's why it wont compile.
If you are using C++17, you can replace it with a constexpr if, that will evaluate the information inside the if during compilation time and ignore the code if needed:
template<class T>
auto foo(T& some_instance)
if constepxr (std::is_base_of_v<Base, T>)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
else
// Whatever you want to do
If you are using an older version of C++ a simple function overload may solve your problem:
template<class T>
auto foo(T& some_instance)
// Do whatever
auto foo(Base& some_instance)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
As an alternative, you can use SFINAE mechanism to peek the right function by using std::enable_if
:
template <typename T>
typename std::enable_if<std::is_base_of<Base, T>::value, void>::type
foo()
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
template <typename T>
typename std::enable_if<!std::is_base_of<Base, T>::value, void>::type
foo()
// Do whatever
2
Your second example is not a specialization, it is an overload. It also wont work if a derived class is passed since the template will produce an exact match.
– NathanOliver
Mar 25 at 16:01
add a comment |
You should take a look into the official doc about SFINAE. The code inside your if will get compiled in any case, so that's why it wont compile.
If you are using C++17, you can replace it with a constexpr if, that will evaluate the information inside the if during compilation time and ignore the code if needed:
template<class T>
auto foo(T& some_instance)
if constepxr (std::is_base_of_v<Base, T>)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
else
// Whatever you want to do
If you are using an older version of C++ a simple function overload may solve your problem:
template<class T>
auto foo(T& some_instance)
// Do whatever
auto foo(Base& some_instance)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
As an alternative, you can use SFINAE mechanism to peek the right function by using std::enable_if
:
template <typename T>
typename std::enable_if<std::is_base_of<Base, T>::value, void>::type
foo()
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
template <typename T>
typename std::enable_if<!std::is_base_of<Base, T>::value, void>::type
foo()
// Do whatever
You should take a look into the official doc about SFINAE. The code inside your if will get compiled in any case, so that's why it wont compile.
If you are using C++17, you can replace it with a constexpr if, that will evaluate the information inside the if during compilation time and ignore the code if needed:
template<class T>
auto foo(T& some_instance)
if constepxr (std::is_base_of_v<Base, T>)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
else
// Whatever you want to do
If you are using an older version of C++ a simple function overload may solve your problem:
template<class T>
auto foo(T& some_instance)
// Do whatever
auto foo(Base& some_instance)
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
As an alternative, you can use SFINAE mechanism to peek the right function by using std::enable_if
:
template <typename T>
typename std::enable_if<std::is_base_of<Base, T>::value, void>::type
foo()
auto lamb2 = [](T& some_instance) ((Base&)some_instance).base_method();
lamb2(some_instance);
template <typename T>
typename std::enable_if<!std::is_base_of<Base, T>::value, void>::type
foo()
// Do whatever
edited Mar 25 at 16:02
answered Mar 25 at 15:59
mohaboujemohabouje
2,7171 gold badge10 silver badges24 bronze badges
2,7171 gold badge10 silver badges24 bronze badges
2
Your second example is not a specialization, it is an overload. It also wont work if a derived class is passed since the template will produce an exact match.
– NathanOliver
Mar 25 at 16:01
add a comment |
2
Your second example is not a specialization, it is an overload. It also wont work if a derived class is passed since the template will produce an exact match.
– NathanOliver
Mar 25 at 16:01
2
2
Your second example is not a specialization, it is an overload. It also wont work if a derived class is passed since the template will produce an exact match.
– NathanOliver
Mar 25 at 16:01
Your second example is not a specialization, it is an overload. It also wont work if a derived class is passed since the template will produce an exact match.
– NathanOliver
Mar 25 at 16:01
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341631%2fpolymorphism-in-template-functions%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I dont want to call base_method from nd. I want to pass variables into template function, and let template function decide whether to call base_method or pass
– Demaunt
Mar 25 at 16:05
oh sorry, I misread your code, my fault ;)
– formerlyknownas_463035818
Mar 25 at 16:17