1 // Copyright Daniel Wallin 2007. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #include <luabind/luabind.hpp>
8 #include <luabind/iterator_policy.hpp>
9 #include <boost/iterator/iterator_adaptor.hpp>
15 for (int i
= 0; i
< 5; ++i
)
20 : boost::iterator_adaptor
<iterator
, int*>
22 static std::size_t alive
;
25 : iterator::iterator_adaptor_(p
)
30 iterator(iterator
const& other
)
31 : iterator::iterator_adaptor_(other
)
44 return iterator(data
);
49 return iterator(data
+ 5);
55 std::size_t container::iterator::alive
= 0;
62 void test_main(lua_State
* L
)
64 using namespace luabind
;
70 .def_readonly("iterable", &cls::iterable
, return_stl_iterator
)
76 "for i in x.iterable do\n"
80 "collectgarbage('collect')\n"
83 assert(container::iterator::alive
== 0);