create boost-python nested namespace
问题 Using boost python I need create nested namespace. Assume I have following cpp class structure: namespace a { class A{...} namespace b { class B{...} } } Obvious solution not work: BOOST_PYTHON_MODULE( a ) { boost::python::class_<a::A>("A") ... ; BOOST_PYTHON_MODULE(b){ boost::python::class_<a::b::B>("B") ... ; } } It causes compile-time error: linkage specification must be at global scope Is there any way to declare class B that would be accessed from Python as a.b.B ? 回答1: What you want is