diff --git a/include/chaiscript/dispatchkit/bootstrap_stl.hpp b/include/chaiscript/dispatchkit/bootstrap_stl.hpp index d910c26..53330bb 100644 --- a/include/chaiscript/dispatchkit/bootstrap_stl.hpp +++ b/include/chaiscript/dispatchkit/bootstrap_stl.hpp @@ -122,16 +122,6 @@ namespace chaiscript return m; } - /** - * Add reversible_container concept to the given ContainerType - * http://www.sgi.com/tech/stl/ReversibleContainer.html - */ - template - ModulePtr reversible_container_type(const std::string &, ModulePtr m = ModulePtr(new Module())) - { - return m; - } - /** * Add random_access_container concept to the given ContainerType * http://www.sgi.com/tech/stl/RandomAccessContainer.html @@ -139,7 +129,6 @@ namespace chaiscript template ModulePtr random_access_container_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) { - reversible_container_type(type, m); typedef typename ContainerType::reference(ContainerType::*indexoper)(size_t); //In the interest of runtime safety for the m, we prefer the at() method for [] access, @@ -169,8 +158,6 @@ namespace chaiscript template ModulePtr container_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) { - assignable_type(type, m); - m->add(fun(&ContainerType::size), "size"); m->add(fun(&ContainerType::empty), "empty"); m->add(fun(&ContainerType::clear), "clear"); @@ -178,19 +165,6 @@ namespace chaiscript return m; } - /** - * Add forward container concept to the given ContainerType - * http://www.sgi.com/tech/stl/ForwardContainer.html - */ - template - ModulePtr forward_container_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) - { - input_range_type(type, m); - container_type(type, m); - - return m; - } - /** * Add default constructable concept to the given Type * http://www.sgi.com/tech/stl/DefaultConstructible.html @@ -245,9 +219,6 @@ namespace chaiscript template ModulePtr sequence_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) { - forward_container_type(type, m); - default_constructible_type(type, m); - std::string insert_name; if (typeid(typename ContainerType::value_type) == typeid(Boxed_Value)) { @@ -269,9 +240,6 @@ namespace chaiscript template ModulePtr back_insertion_sequence_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) { - sequence_type(type, m); - - typedef typename ContainerType::reference (ContainerType::*backptr)(); m->add(fun(static_cast(&ContainerType::back)), "back"); @@ -297,8 +265,6 @@ namespace chaiscript template ModulePtr front_insertion_sequence_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) { - sequence_type(type, m); - typedef typename ContainerType::reference (ContainerType::*frontptr)(); m->add(fun(static_cast(&ContainerType::front)), "front"); @@ -315,44 +281,6 @@ namespace chaiscript return m; } - /** - * hopefully working List type - * http://www.sgi.com/tech/stl/List.html - */ - template - ModulePtr list_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) - { - m->add(user_type(), type); - front_insertion_sequence_type(type, m); - back_insertion_sequence_type(type, m); - return m; - } - - /** - * Create a vector type with associated concepts - * http://www.sgi.com/tech/stl/Vector.html - */ - template - ModulePtr vector_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) - { - m->add(user_type(), type); - random_access_container_type(type, m); - back_insertion_sequence_type(type, m); - return m; - } - - /** - * Create a vector type with associated concepts - * http://www.sgi.com/tech/stl/Vector.html - */ - template - ModulePtr associative_container_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) - { - forward_container_type(type, m); - default_constructible_type(type, m); - return m; - } - /** * bootstrap a given PairType * http://www.sgi.com/tech/stl/pair.html @@ -379,7 +307,6 @@ namespace chaiscript template ModulePtr pair_associative_container_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) { - associative_container_type(type, m); pair_type(type + "_Pair", m); return m; @@ -392,41 +319,11 @@ namespace chaiscript template ModulePtr unique_associative_container_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) { - associative_container_type(type, m); m->add(fun(&ContainerType::count), "count"); return m; } - /** - * Add sorted associative container concept to the given ContainerType - * http://www.sgi.com/tech/stl/SortedAssociativeContainer.html - */ - template - ModulePtr sorted_associative_container_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) - { - typedef std::pair - (ContainerType::*eq_range)(const typename ContainerType::key_type &); - - reversible_container_type(type, m); - associative_container_type(type, m); - - return m; - } - - /** - * Add unique sorted associative container concept to the given ContainerType - * http://www.sgi.com/tech/stl/UniqueSortedAssociativeContainer.html - */ - template - ModulePtr unique_sorted_associative_container_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) - { - sorted_associative_container_type(type, m); - unique_associative_container_type(type, m); - - return m; - } - /** * Add a MapType container * http://www.sgi.com/tech/stl/Map.html @@ -436,12 +333,57 @@ namespace chaiscript { m->add(user_type(), type); m->add(fun(&MapType::operator[]), "[]"); - unique_sorted_associative_container_type(type, m); + + container_type(type, m); + assignable_type(type, m); + unique_associative_container_type(type, m); pair_associative_container_type(type, m); + input_range_type(type, m); return m; } + /** + * hopefully working List type + * http://www.sgi.com/tech/stl/List.html + */ + template + ModulePtr list_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) + { + m->add(user_type(), type); + + front_insertion_sequence_type(type, m); + back_insertion_sequence_type(type, m); + sequence_type(type, m); + container_type(type, m); + default_constructible_type(type, m); + assignable_type(type, m); + input_range_type(type, m); + + return m; + } + + /** + * Create a vector type with associated concepts + * http://www.sgi.com/tech/stl/Vector.html + */ + template + ModulePtr vector_type(const std::string &type, ModulePtr m = ModulePtr(new Module())) + { + m->add(user_type(), type); + + back_insertion_sequence_type(type, m); + sequence_type(type, m); + random_access_container_type(type, m); + container_type(type, m); + default_constructible_type(type, m); + assignable_type(type, m); + input_range_type(type, m); + + return m; + } + + /** * Add a String container * http://www.sgi.com/tech/stl/basic_string.html @@ -455,6 +397,10 @@ namespace chaiscript opers_comparison(m); random_access_container_type(type, m); sequence_type(type, m); + default_constructible_type(type, m); + container_type(type, m); + assignable_type(type, m); + input_range_type(type, m); //Special case: add push_back to string (which doesn't support other back_insertion operations std::string push_back_name;