Using the any_iterator—or any type-erasing class, for that matter—is not without pitfalls. Please read the section entitled "Important Warning: Type Erasure Erases Interoperability" in the HTML documentation in the directory documentation of this distribution. You may also read this warning online.