boostorg / array Goto Github PK
View Code? Open in Web Editor NEWBoost.org array module
Home Page: http://boost.org/libs/array
Boost.org array module
Home Page: http://boost.org/libs/array
Defining overloads in namespace std
is undefined behavior, so I'm wondering why we're adding overloads of std::get
for boost::array
. Since we aren't specializing std::tuple_size
or std::tuple_element
, these overloads would never be used anyway, even if they were legal.
Hello, there is an off-by-one error in the range check for at(). The function at() doesn't throw an exception if the index is the size of the array.
The following program doesn't throw the expected exception.
#include <boost/array.hpp>
#include <iostream>
int main()
{
boost::array<int,1> a;
try {
a.at(1) = 12;
} catch (const std::out_of_range& e) {
std::cerr << e.what() << std::endl;
}
return 0;
}
The cause of this error is a wrong comparison in rangecheck(), which can be fixed with following patch:
diff --git a/include/boost/array.hpp b/include/boost/array.hpp
index 210c072..99dc2c6 100644
--- a/include/boost/array.hpp
+++ b/include/boost/array.hpp
@@ -183,7 +183,7 @@ namespace boost {
// check range (may be private because it is static)
static BOOST_CONSTEXPR bool rangecheck (size_type i) {
- return i > size() ? boost::throw_exception(std::out_of_range ("array<>: index out of range")), true : true;
+ return i >= size() ? boost::throw_exception(std::out_of_range ("array<>: index out of range")), true : true;
}
};
I'm seeing a warning being emitted by this library when I'm using Xcode 10.3:
Line 185 in 92f66a9
Possible misuse of comma operator here
Initially I thought of making a PR to address it, but I don't really understand the expression at that line. Why is boost::throw_exception
followed by , true
?
Is this note up to date?
Lines 5 to 6 in e5f4af3
CMakeLists.txt
have been added across many if not most libraries now, and Boost.Array seems to be missing the following
project(boost_array VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
Install
# boost_install requires PROJECT_VERSION
# Without the superproject, we don't have any, so skip installation
if(BOOST_SUPERPROJECT_VERSION)
include(BoostInstall)
boost_install(TARGETS boost_assert HEADER_DIRECTORY include/)
endif()
# BUILD_TESTING is the standard CTest variable that enables testing
if(BUILD_TESTING)
add_subdirectory(test)
endif()
Question is if these are applicable or perhaps Boost.Array has a different plan.
We are in the process of making B2 build changes to all of the B2 build files
to support "modular" consumption of the Boost Libraries by users. See this list
post for some details: https://lists.boost.org/Archives/boost/2024/01/255704.php
The process requires making a variety of changes to make each Boost library
independent of the super-project structure. But the changes do not remove the
super-project structure or the comprehensive Boost release. The changes make
solely make it possible, optionally, for users, like package manages, to easily
consume libraries individually.
Generally the changes include:
Some examples of such changes:
We are asking how you would like us to handle the changes. We would prefer if
you allow the owners of the Boost.org GitHub project to make changes to B2
build files, as needed, to accomplish the changes. But understand
that you may want to manage the proposed changes yourself.
We previously sent emails to all known maintainers to fill out a form with their
preference. We are contacting you in this issue as we have not gotten a response
to that email. You can see the ongoing responses for that form and the responses
to these issues here https://github.com/users/grafikrobot/projects/1/views/6
We are now asking if you can reply directly to this issue to indicate your
preference of handling the changes. Please supply a response to this question
and close the issue (so that we can verify you are a maintainer).
How would you like the build changes to be processed?
Also please indicate any special instructions you want us to consider. Or other
information you want us to be aware of.
Thanks you, René
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.