Skip to content

Commit

Permalink
Remove array subscript operator object::operator []
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Nov 4, 2023
1 parent b22691b commit 76fe894
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 83 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.71_amd64.deb
sudo apt install build/meevax_0.5.72_amd64.deb
```

or
Expand Down Expand Up @@ -123,9 +123,9 @@ sudo rm -rf /usr/local/share/meevax

| Target Name | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.71.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.72.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.71_amd64.deb`
| `package` | Generate debian package `meevax_0.5.72_amd64.deb`
| `install` | Copy files into `/usr/local` directly

## Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.71
0.5.72
4 changes: 0 additions & 4 deletions include/meevax/kernel/pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ inline namespace kernel

virtual auto write(std::ostream &) const -> std::ostream &;

virtual auto operator [](std::size_t) const -> object const&;

virtual auto operator [](std::size_t) -> object &;

constexpr auto begin() noexcept
{
return iterator(this);
Expand Down
4 changes: 0 additions & 4 deletions include/meevax/kernel/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ inline namespace kernel
explicit heterogeneous_vector(Iterator begin, Iterator end)
: vector { begin, end }
{}

auto operator [](std::size_t) const -> object const&;

auto operator [](std::size_t) -> object &;
};

auto operator ==(heterogeneous_vector const&, heterogeneous_vector const&) -> bool;
Expand Down
51 changes: 0 additions & 51 deletions include/meevax/memory/heterogeneous_pointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <meevax/iostream/escape_sequence.hpp>
#include <meevax/iostream/lexical_cast.hpp>
#include <meevax/memory/gc_pointer.hpp>
#include <meevax/type_traits/is_array_subscriptable.hpp>
#include <meevax/type_traits/is_equality_comparable.hpp>
#include <meevax/type_traits/is_output_streamable.hpp>
#include <meevax/utility/combination.hpp>
Expand Down Expand Up @@ -84,30 +83,6 @@ inline namespace memory
return os << magenta("#,(") << green(typeid(Bound).name()) << faint(" #;", static_cast<Bound const*>(this)) << magenta(")");
}
}

auto operator []([[maybe_unused]] std::size_t k) const -> heterogeneous_pointer const& override
{
if constexpr (is_array_subscriptable_v<Bound const&>)
{
return static_cast<Bound const&>(*this)[k];
}
else
{
throw std::runtime_error(lexical_cast<std::string>("no viable array subscript operator for ", demangle(type())));
}
}

auto operator []([[maybe_unused]] std::size_t k) -> heterogeneous_pointer & override
{
if constexpr (is_array_subscriptable_v<Bound &>)
{
return static_cast<Bound &>(*this)[k];
}
else
{
throw std::runtime_error(lexical_cast<std::string>("no viable array subscript operator for ", demangle(type())));
}
}
};

public:
Expand Down Expand Up @@ -236,32 +211,6 @@ inline namespace memory
}
}

[[deprecated]]
inline auto operator [](std::size_t k) const -> heterogeneous_pointer const&
{
if (dereferenceable() and *this)
{
return get()->operator [](k);
}
else
{
throw std::runtime_error(lexical_cast<std::string>("no viable array subscript operator for ", demangle(type())));
}
}

[[deprecated]]
inline auto operator [](std::size_t k) -> heterogeneous_pointer &
{
if (dereferenceable() and *this)
{
return get()->operator [](k);
}
else
{
throw std::runtime_error(lexical_cast<std::string>("no viable array subscript operator for ", demangle(type())));
}
}

friend auto operator <<(std::ostream & os, heterogeneous_pointer const& datum) -> std::ostream &
{
return datum.write(os);
Expand Down
10 changes: 0 additions & 10 deletions src/kernel/pair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ inline namespace kernel
return os << *this;
}

auto pair::operator [](std::size_t k) const -> object const&
{
return 0 < k ? second[--k] : first;
}

auto pair::operator [](std::size_t k) -> object &
{
return 0 < k ? second[--k] : first;
}

auto operator <<(std::ostream & os, pair const& datum) -> std::ostream &
{
if (is_circular_list(cdr(datum)))
Expand Down
10 changes: 0 additions & 10 deletions src/kernel/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ inline namespace kernel
: vector { size, x }
{}

auto heterogeneous_vector::operator [](std::size_t index) const -> object const&
{
return vector[index];
}

auto heterogeneous_vector::operator [](std::size_t index) -> object &
{
return vector[index];
}

auto operator ==(heterogeneous_vector const& v, heterogeneous_vector const& u) -> bool
{
return std::equal(v.vector.begin(), v.vector.end(),
Expand Down

0 comments on commit 76fe894

Please sign in to comment.