I’m starting to write a library and considering its interface. Previous libraries I’ve written all use raw pointers (both internally and in its interface), and now I want to try the smart pointer library that comes with VS2010.
- Should the interface use smart pointers? (Possibly forcing the library users to use smart pointers too?)
- Would it be messy if the interface uses raw pointers but the library uses smart pointers internally? (Is it even possible? shared_ptr doesn’t have a release() method…)
- Can two c++0x compliant smart pointer libraries (say boost and VS2010) be used interchangeably? (say I use VS2010 to write my library and the users use boost)
Please help 🙂
It is imposable to answer those question without understanding a lot more about your design principles and how you expect the library to be used.
So I can only answer based on my experience and how I like my libraries to be used.
But you can compensate for this:
As most open source is distributed as source you can build your source so that it can be configured for use in many environments.
For Example:
I am sure there are other ways to do this.
But it is late.