Why is ADL not working with Boost.Range?

后端 未结 3 575
误落风尘
误落风尘 2021-01-11 10:43

Considering:

#include 
#include 
#include 

int main() {
    auto range = boost         


        
3条回答
  •  攒了一身酷
    2021-01-11 10:53

    That's because boost::end is inside an ADL barrier, which is then pulled in boost at the end of the file.

    However, from cppreference's page on ADL (sorry, I don't have a C++ draft handy):

    1) using-directives in the associated namespaces are ignored

    That prevents it from being included in ADL.

提交回复
热议问题