J
Jon Slaughter
At the bottom of the page on
http://ootips.org/yonat/4dev/smart-pointers.html
It is noted that one would use different types of pointers based on
different "locations" in the code. What I'm wondering is if there is a way
to have the compiler automatically determine which type to use depending on
its location such as
class T
{
MyUberPointer<int> i;
}
vs.
void func()
{
myUberPointer<int> i;
}
so that MyUberPointer uses a copied pointer while myUberPointer uses an auto
pointer
one might have some policy based parameter so that one could override the
default, but in this case the default is "location" dependent. i.e., it
would be nice if there was an implicit parameter passed to templates that
held the location of its decleration similar to the way the this pointer
works... then one could have seperate template definitions depending on the
location. Hence one could easily have "polymorphism" of types based on
"location". I do know one can easily do this by having some extra parameter
such as
class T
{
UberPointer<int,1> i;
}
vs.
void func()
{
UberPointer<int,0> i;
}
but ofcourse this isn't the best way.
Jon
http://ootips.org/yonat/4dev/smart-pointers.html
It is noted that one would use different types of pointers based on
different "locations" in the code. What I'm wondering is if there is a way
to have the compiler automatically determine which type to use depending on
its location such as
class T
{
MyUberPointer<int> i;
}
vs.
void func()
{
myUberPointer<int> i;
}
so that MyUberPointer uses a copied pointer while myUberPointer uses an auto
pointer
one might have some policy based parameter so that one could override the
default, but in this case the default is "location" dependent. i.e., it
would be nice if there was an implicit parameter passed to templates that
held the location of its decleration similar to the way the this pointer
works... then one could have seperate template definitions depending on the
location. Hence one could easily have "polymorphism" of types based on
"location". I do know one can easily do this by having some extra parameter
such as
class T
{
UberPointer<int,1> i;
}
vs.
void func()
{
UberPointer<int,0> i;
}
but ofcourse this isn't the best way.
Jon