Boost logo

Boost Users :

Subject: Re: [Boost-users] behavior conditional on template argument
From: Matthieu Brucher (matthieu.brucher_at_[hidden])
Date: 2009-01-21 05:28:30


Hi,

You can use enable_if to let the compiler decide which one it should
instantiate. And the argument will be a custom defined type trait. I
think there are facilities to automatically define it on the presence
of a type, there may be soemthing for fucntions as well, but I don't
remember where they live (MPL ?)

Matthieu

2009/1/21 Hicham Mouline <hicham_at_[hidden]>:
> Hello,
>
> I have a template function
>
>
> template <typename M>
> void f(const M&)
> {
> // call M.f1()
> // call M.f2()
>
> // some Ms have a function f1Andf2() which does f1()+ f2() work faster
> // how can I write code that runs f1Andf2() if it's there
> // otherwise runs f1() then f2()
> }
>
> regards,
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/matthieubrucher

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net