diff --git a/boxedcpp/bootstrap_stl.hpp b/boxedcpp/bootstrap_stl.hpp new file mode 100644 index 0000000..91e3c20 --- /dev/null +++ b/boxedcpp/bootstrap_stl.hpp @@ -0,0 +1,65 @@ +#ifndef __bootstrap_stl_hpp +#define __bootstrap_stl_hpp__ + +#include "boxedcpp.hpp" + +template +void bootstrap_reversible_container(BoxedCPP_System &system) +{ +} + +template +void bootstrap_random_access_container(BoxedCPP_System &system) +{ + bootstrap_reversible_container(system); + + typedef typename ContainerType::reference(ContainerType::*indexoper)(size_t); + + system.register_function( + boost::function(indexoper(&ContainerType::operator[])), "[]"); +} + +template +void bootstrap_container(BoxedCPP_System &system) +{ +} + +template +void bootstrap_forward_container(BoxedCPP_System &system) +{ + bootstrap_container(system); +} + +template +void bootstrap_default_constructible(BoxedCPP_System &system) +{ +} + +template +void bootstrap_sequence(BoxedCPP_System &system) +{ + bootstrap_forward_container(system); + bootstrap_default_constructible(system); +} + +template +void bootstrap_back_insertion_sequence(BoxedCPP_System &system) +{ + bootstrap_sequence(system); + + + typedef typename SequenceType::reference (SequenceType::*backptr)(); + + system.register_function(boost::function(backptr(&SequenceType::back)), "back"); + system.register_function(boost::function(&SequenceType::push_back), "push_back"); + system.register_function(boost::function(&SequenceType::pop_back), "pop_back"); +} + +template +void bootstrap_vector(BoxedCPP_System &system) +{ + bootstrap_random_access_container(system); + bootstrap_back_insertion_sequence(system); +} + +#endif diff --git a/boxedcpp/test.cpp b/boxedcpp/test.cpp index 4a7cbb0..340c5eb 100644 --- a/boxedcpp/test.cpp +++ b/boxedcpp/test.cpp @@ -6,6 +6,7 @@ #include "boxedcpp.hpp" #include "bootstrap.hpp" +#include "bootstrap_stl.hpp" struct Test { @@ -89,6 +90,7 @@ int main() { BoxedCPP_System ss; bootstrap(ss); + bootstrap_vector >(ss); dump_system(ss); //Calling a function by name and allowing the built in dispatch mechanism to