Re: [Math / Distributions] How do mean, variance, etc end up in scope?

Warren Weckesser via Boost-users <[email protected]>
Newsgroups gmane.comp.lib.boost.user
Message-ID <CAGzF1uc0J1z07rcDzjsCF0Otyw51ojO-tPhb+VmN__=mDbK+jQ@mail.gmail.com>
On 5/2/22, Andrea Bocci <[email protected]> wrote:
> Hi Warren,
>
> On Mon, 2 May 2022, 03:29 Warren Weckesser via Boost-users, <
> [email protected]> wrote:
>
>>
>> In a program like this:
>>
>> ```
>> #include <boost/math/distributions/beta.hpp>
>>
>> using boost::math::beta_distribution;
>>
>> int main()
>> {
>>     float a = 1.5f;
>>     float b = 3.0f;
>>     beta_distribution<float> dist(a, b);
>>
>>     auto m = mean(dist);
>> }
>> ```
>>
>> how does the name 'mean' end up in scope in 'main()'?
>>
>
> this is indeed a C++ question: what you are observing is called "argument
> dependent lookup".

>
> For more information you can check
> https://en.cppreference.com/w/cpp/language/adl .
>
>
> Hope this helps,

Indeed it does!  Thanks, Andrea.

Warren
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.