Example #1
0
    def test01_STL_like_class_indexing_overloads(self):
        """Test overloading of operator[] in STL like class"""

        from cppyy.gbl import STLLikeClass

        a = STLLikeClass(int)()
        assert a["some string"] == 'string'
        assert a[3.1415] == 'double'
Example #2
0
    def test02_STL_like_class_iterators(self):
        """Test the iterator protocol mapping for an STL like class"""

        from cppyy.gbl import STLLikeClass

        a = STLLikeClass(int)()
        for i in a:
            pass

        assert i == 3