Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make json.hpp aware of the modules TS? #891

Closed
AraHaan opened this issue Dec 22, 2017 · 6 comments
Closed

Make json.hpp aware of the modules TS? #891

AraHaan opened this issue Dec 22, 2017 · 6 comments
Labels
state: needs more info the author of the issue needs to provide more details

Comments

@AraHaan
Copy link

AraHaan commented Dec 22, 2017

Bug Report

  • What is the issue you have?
    Using json.hpp with the Modules TS.

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

  1. Enable the modules TS.
  2. try to import std.core; before #include <json.hpp>
  3. ???
  • What is the expected behavior?
    For json.hpp to ifdef some macro for if the user has the modules TS to import the standard library dependencies instead of #includeing them. However I am not sure such macro exists.

  • And what is the actual behavior instead?
    No check whatsoever and include of the standard library headers separately.

  • Which compiler and operating system are you using? Is it a supported compiler?
    MSVC++ 2017 15.5.2, Windows 7 Ultimate build 7601 SP1 x64

  • Did you use a released version of the library or the version from the develop branch?
    Develop branch

  • If you experience a compilation error: can you compile and run the unit tests?
    Unsure on compile errors.

Also this might be unrelivant to the issue, It would also be nice if the json.hpp could be imported as well just like std.core by import json;

@AraHaan
Copy link
Author

AraHaan commented Dec 22, 2017

I have just proposed an _HAS_MODULES_TS Macro into VS2017 to Microsoft. Be nice if GCC and clang was to get this macro too when the modules TS is enabled.

@nlohmann
Copy link
Owner

I have no idea how we could or should adjust our code to support Modules TS. Could you please post the errors you observe?

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Dec 23, 2017
@AraHaan
Copy link
Author

AraHaan commented Dec 23, 2017

sure, when using it the intelisence in VS2017 seems to think there is an issue with std::swap and the reason why I raised this issue with Microsfot to provide an macro that is defined when it is turn on so all of this:

#include <algorithm> // all_of, copy, fill, find, for_each, generate_n, none_of, remove, reverse, transform
#include <array> // array
#include <cassert> // assert
#include <ciso646> // and, not, or
#include <clocale> // lconv, localeconv
#include <cmath> // isfinite, labs, ldexp, signbit
#include <cstddef> // nullptr_t, ptrdiff_t, size_t
#include <cstdint> // int64_t, uint64_t
#include <cstdlib> // abort, strtod, strtof, strtold, strtoul, strtoll, strtoull
#include <cstring> // memcpy, strlen
#include <forward_list> // forward_list
#include <functional> // function, hash, less
#include <initializer_list> // initializer_list
#include <iomanip> // hex
#include <iosfwd>   // istream, ostream
#include <iterator> // advance, begin, back_inserter, bidirectional_iterator_tag, distance, end, inserter, iterator, iterator_traits, next, random_access_iterator_tag, reverse_iterator
#include <limits> // numeric_limits
#include <locale> // locale
#include <map> // map
#include <memory> // addressof, allocator, allocator_traits, unique_ptr
#include <numeric> // accumulate
#include <sstream> // stringstream
#include <string> // getline, stoi, string, to_string
#include <type_traits> // add_pointer, conditional, decay, enable_if, false_type, integral_constant, is_arithmetic, is_base_of, is_const, is_constructible, is_convertible, is_default_constructible, is_enum, is_floating_point, is_integral, is_nothrow_move_assignable, is_nothrow_move_constructible, is_pointer, is_reference, is_same, is_scalar, is_signed, remove_const, remove_cv, remove_pointer, remove_reference, true_type, underlying_type
#include <utility> // declval, forward, make_pair, move, pair, swap
#include <valarray> // valarray
#include <vector> // vector

would then be:

import std.core;
import std.memory;

only when it is defined.

Although probably an better option is an macro someone can define where those are not explicitly included when defined where the user can include them themselves.

@nlohmann
Copy link
Owner

But how can a TS which is not yet part of C++ be an issue for a C++11 library?

@AraHaan
Copy link
Author

AraHaan commented Dec 23, 2017

When the library is also used in newer versions of C++ as well, but the rest might be true and might have to be considered by the compiler people as well.

@nlohmann
Copy link
Owner

If Modules TS is part of the language, then not only my library, but all libraries would have issues, and I think this is either a bug or there will be macros to detect this. Until then, there is nothing we can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs more info the author of the issue needs to provide more details
Projects
None yet
Development

No branches or pull requests

2 participants