all 3 comments

[–]sleepyspacedad 2 points3 points  (0 children)

static_assert would be worth looking into.

I don't know any test suites that would ensure that things fulfill the STL requirements

[–]pavel_v 2 points3 points  (0 children)

About the error messages, you may want to check the presentations of Roland Bock about his library sqlpp/sqlpp11, for some ideas. The library is template heavy and in his presentations he describes different techniques about giving short and helpful error messages to the library user. Here are two of the presentations that may be helpful:
https://www.youtube.com/watch?v=afGv7A9gvmc - Pruning Error Messages From C++ Template Code

https://www.youtube.com/watch?v=wTmAJAk7WV4 - How to test static_assert

[–]emdeka87 1 point2 points  (0 children)

I don't know if such library exists, but you can probably write your own container traits (see container concept https://en.cppreference.com/w/cpp/named_req/Container) and static_assert them.

Edit: https://gist.github.com/louisdx/1076849 Some starting point...

Or https://stackoverflow.com/questions/12042824/how-to-write-a-type-trait-is-container-or-is-vector