cons: rework API to utilize C++11
commit49b8bfb48a5b6cd62a5a1994ee247c9077a0b2bd
authormdempsky <mdempsky@chromium.org>
Wed, 15 Oct 2014 02:33:47 +0000 (14 19:33 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 15 Oct 2014 02:34:05 +0000 (15 02:34 +0000)
treeb71ba0a410e93b89aea92a92c560957725787bc7
parent8ab0f9e5e639f94a0c2d39e3a1986391305d5f7b
cons: rework API to utilize C++11

In particular, this CL makes four changes:

1. Taking advantage of C++11's templated type aliases, we can replace
the awkward "Cons<T>::List" type with the somewhat more idiomatic
"cons::List<T>" type.

2. To allow cons lists to be usable with C++11 range-based for loops,
add a C++-style iterator wrapper and begin()/end() functions.

3. Use "nullptr" to create a nil list instead of "Cons<Foo>::List()".

4. Rename the "Cons" type to "Cell" so that "Cons" can instead
idiomatically name the function that constructs a new list cell.

BUG=414363

Review URL: https://codereview.chromium.org/652093002

Cr-Commit-Position: refs/heads/master@{#299633}
sandbox/linux/bpf_dsl/bpf_dsl.cc
sandbox/linux/bpf_dsl/bpf_dsl.h
sandbox/linux/bpf_dsl/cons.h
sandbox/linux/bpf_dsl/cons_unittest.cc