mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-07 01:06:54 +08:00
Correct registration of array[]. (Rollback to previous version) to fix broken unit tests.
This commit is contained in:
parent
7f71c77e56
commit
45fbe2028a
@ -114,13 +114,15 @@ namespace dispatchkit
|
|||||||
void bootstrap_random_access_container(Dispatch_Engine &system, const std::string &type)
|
void bootstrap_random_access_container(Dispatch_Engine &system, const std::string &type)
|
||||||
{
|
{
|
||||||
bootstrap_reversible_container<ContainerType>(system, type);
|
bootstrap_reversible_container<ContainerType>(system, type);
|
||||||
|
|
||||||
typedef typename ContainerType::reference(ContainerType::*indexoper)(size_t);
|
typedef typename ContainerType::reference(ContainerType::*indexoper)(size_t);
|
||||||
|
|
||||||
//In the interest of runtime safety for the system, we prefer the at() method for [] access,
|
//In the interest of runtime safety for the system, we prefer the at() method for [] access,
|
||||||
//to throw an exception in an out of bounds condition.
|
//to throw an exception in an out of bounds condition.
|
||||||
register_function(system, indexoper(&ContainerType::at), "[]");
|
system.register_function(
|
||||||
register_function(system, indexoper(&ContainerType::operator[]), "at");
|
boost::function<typename ContainerType::reference (ContainerType *, int)>(indexoper(&ContainerType::at)), "[]");
|
||||||
|
system.register_function(
|
||||||
|
boost::function<typename ContainerType::reference (ContainerType *, int)>(indexoper(&ContainerType::operator[])), "at");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user