|
Boost : |
From: Hurd, Matthew (hurdm_at_[hidden])
Date: 2004-03-29 03:13:00
Trying to find the neatest way to do this:
template <class U >
class c
{
template< class S = U>
void f(Param p)
{
S::other lock(a);
}
U::something a;
};
That is, I'm trying to work around not have function/method template
defaults.
Trying to find the least messy solution for a boost::synch library that
can use alternative locking strategies, e.g. none, for a particular
mutex, e.g. shareable.
This is about the simplest I think I can come up with:
template <class U >
class c
{
void f(Param p)
{
f<U>(p);
}
template< S >
void f(Param p)
{
S::other lock(a);
}
U::something a;
};
and I could use the boost pp lib to get it to something like
template <class U >
class c
{
HACKEROOSKI ( U, void, f, Param, p)
{
S::other lock(a);
}
U::something a;
};
but it is something almost every method I write will need so I end up
with ugly macro code everywhere.
Inner class with a default template and static fn's with a reference
being passed in from the out doesn't seem to buy me much in the
prettiness stakes.
Any ideas on how best to approximate a default type for a template
method? Is there a standard trick for this?
Regards,
Matt Hurd
_______________________
Susquehanna Pacific P/L
hurdm_at_[hidden]
+61.2.8226.5029
_______________________
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk