Re: How to bind subscript operator

feng qiu <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
Try to overwrite __index of the class table.

On 18 April 2011 09:22, he keding <[email protected]> wrote:

> hi, all
>
> How to bind subscript operator []
>
> For example
>
> class Node
> {
> public:
>     int GetValue();
> ...
> };
>
> class BindClass
> {
> public:
>     int operator [] (int index)
>     {
>         return m_nodes[index].GetValue();
>     }
>
>     std::vector<Node> m_nodes;
> };
>
> In lua, i want code this style:
>
> -- bindClass is BindClass instance.
> bindClass[2] = 10;
>
> How to bind, I google but found no solution.
>
> Thanks.
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
>


-- 
邱烽

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.