Coder Social home page Coder Social logo

numeric_conversion's Introduction

Boost.NumericConversion

The Boost Numeric Conversion library is a collection of tools to describe and perform conversions between values of different numeric types.

The documentation for the library can be found here

numeric_conversion's People

Contributors

apolukhin avatar beman avatar blowaxd avatar brandon-kohn avatar brycelelbach avatar dabrahams avatar danieljames avatar douggregor avatar eldiener avatar eugenezelenko avatar fcacciola avatar glenfe avatar grafikrobot avatar imikejackson avatar joaquintides avatar jzmaddock avatar kojoley avatar lakshayg avatar mclow avatar nmusatti avatar patak-dev avatar pdimov avatar romain-geissler-1a avatar steveire avatar straszheim avatar swatanabe avatar vprus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

numeric_conversion's Issues

GCC suggest-override warnings

Complete list of warnings when Boost 1.72 is built with GCC 7.5 with -Wsuggest-override added to cxxflags:

./boost/numeric/conversion/converter_policies.hpp:140:26: warning: ‘virtual const char* boost::numeric::bad_numeric_cast::what() const’ can be marked override [-Wsuggest-override]
./boost/numeric/conversion/converter_policies.hpp:148:26: warning: ‘virtual const char* boost::numeric::negative_overflow::what() const’ can be marked override [-Wsuggest-override]
./boost/numeric/conversion/converter_policies.hpp:155:26: warning: ‘virtual const char* boost::numeric::positive_overflow::what() const’ can be marked override [-Wsuggest-override]

BOOST_OVERRIDE was introduced in boostorg/config@ffe4e0f.

MSVC compiler error with /std:c++latest

Using the newest Visual Studio 2017 and its C++ compiler:

The errors mean

  • ',' is missing before ''
  • Siehe Verweis auf die Klasse Vorlage- Instanziierung: See reference to the Class Template-Instantiation
  • Schlüsselwort "typename" ist in : Keyword 'typename' is in

Could this be a compiler error?

C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(453): error C2143: Syntaxfehler: Es fehlt "," vor "
<" [C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]
  C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(467): note: Siehe Verweis auf die Klasse Vorlage-
  Instanziierung "boost::numeric::convdetail::trivial_converter_impl<Traits>", die kompiliert wird.
C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(453): error C2518: Schlüsselwort "typename" ist in
der Basisklassenliste ungültig und wird ignoriert [C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]
C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(454): error C2518: Schlüsselwort "typename" ist in
der Basisklassenliste ungültig und wird ignoriert [C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]
C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(474): error C2143: Syntaxfehler: Es fehlt "," vor "
<" [C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]
  C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(497): note: Siehe Verweis auf die Klasse Vorlage-
  Instanziierung "boost::numeric::convdetail::rounding_converter<Traits,RangeChecker,RawConverter,Float2IntRounder>", d
  ie kompiliert wird.
C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(474): error C2518: Schlüsselwort "typename" ist in
der Basisklassenliste ungültig und wird ignoriert [C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]
C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(475): error C2518: Schlüsselwort "typename" ist in
der Basisklassenliste ungültig und wird ignoriert [C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]
C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(504): error C2143: Syntaxfehler: Es fehlt "," vor "
<" [C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]
  C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(526): note: Siehe Verweis auf die Klasse Vorlage-
  Instanziierung "boost::numeric::convdetail::non_rounding_converter<Traits,RangeChecker,RawConverter>", die kompiliert
   wird.
C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(504): error C2518: Schlüsselwort "typename" ist in
der Basisklassenliste ungültig und wird ignoriert [C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]
C:\local\boost_1_64_0\boost/numeric/conversion/detail/converter.hpp(505): error C2518: Schlüsselwort "typename" ist in
der Basisklassenliste ungültig und wird ignoriert [C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]
C:\local\boost_1_64_0\boost/algorithm/string/detail/case_conv.hpp(33): error C2143: Syntaxfehler: Es fehlt "," vor "<"
[C:\Users\jtroelsen\ifcconverter\ifcconverter.vcxproj]

https://github.com/boostorg/numeric_conversion/blob/boost-1.64.0/include/boost/numeric/conversion/detail/converter.hpp#L453

Investigate making numeric_cast use BOOST_CONSTEXPR.

TODO: I can't think of any reasons off the top of my head why this wouldn't work. I use numeric_cast to perform scaling conversions for a fixed_point type. This is required for the constructor of the fixed_point to be constexpr.

Remove deprecated Boost.Test code.

Boost.Test has deprecated the use of non-header only builds. This is a reminder to change numeric_conversion to use the header only version.

traits_test fails on msvc-14.1+ in 64bit debug mode with C1128 error

b2 variant=debug address-model=64 toolset=msvc-14.1 libs/numeric/conversion/test//traits_test

boost\libs\numeric\conversion\test\traits_test.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj

Either placing <toolset>msvc:<cxxflags>/bigobj or <toolset>msvc:<debug-symbols>off solves the problem.

Compile Error MSVC C++ 2017

std::unary_function has been removed from C++ 17 standard so it does not compile anymore on MSVC

Setup :
Lastest MSVC
C++ 2017

Thanks to Mylerius for the help.
Merge request : #7

Compile error when config/suffix.hpp is included before numeric/conversion/cast.hpp

The following testcase against boost 1.61.0:

#include <boost/config/suffix.hpp>
#include <boost/numeric/conversion/cast.hpp>

int main() {
    return 0;
}

When compiled with clang++ on OS X with -std=c++11 results in this compile error:

/Users/dane/projects/node-osrm/mason_packages/.link/include/boost/type_traits/is_integral.hpp:75:38: error: no member named 'int128_type' in namespace 'boost'
template<> struct is_integral<boost::int128_type> : public true_type{};
                              ~~~~~~~^
/Users/dane/projects/node-osrm/mason_packages/.link/include/boost/type_traits/is_integral.hpp:76:38: error: no member named 'uint128_type' in namespace 'boost'
template<> struct is_integral<boost::uint128_type> : public true_type{};

When not compiled with -std=c++11 then a different compile error happens:

/Users/dane/projects/node-osrm/mason_packages/.link/include/boost/mpl/aux_/integral_wrapper.hpp:80:5: error: unknown type name 'constexpr'
    BOOST_CONSTEXPR operator AUX_WRAPPER_VALUE_TYPE() const { return static_cast<AUX_WRAPPER_VALUE_TYPE>(this->value); } 
    ^
/Users/dane/projects/node-osrm/mason_packages/.link/include/boost/config/suffix.hpp:951:25: note: expanded from macro 'BOOST_CONSTEXPR'
#define BOOST_CONSTEXPR constexpr

Both of the compile errors can be worked around by changing the include order. This works fine:

#include <boost/numeric/conversion/cast.hpp>
#include <boost/config/suffix.hpp>

int main() {
    return 0;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.