Hacker News new | ask | show | jobs
by tomjakubowski 3231 days ago
> understanding of modern style versioned modules in C++.

Could you enlighten us about this? Is this something to do with the eternal C++ modules proposal that never seems to make it into a standard?

The thing that comes to my mind when I hear "versioned modules" and "C++" is the way you can use "versioned" namespace re-exports to avoid ABI breakage, like so:

    // header for version 1 of library
    namespace mylib {
    namespace v1 {
      struct Foo {
        int num_apples;
      };
    }
    using namespace v1;
    }
    
    // header for version 2 of library
    namespace mylib {
    namespace v1 {
      class Foo {
        int num_apples;
      };
    }
    namespace v2 {
      class Foo {
        int num_apples;
        int num_bananas;
      };
    }
    using namespace v2;
    }
But I don't think that's what you mean.