- Using libc++ on Linux
- Libc++ Configuration Macros
- Libc++ Extensions
- Extended applications of
[[nodiscard]]
- Extended applications of
The following libvirt-lxc packages are deprecated starting with Red Hat Enterprise Linux 7.1: libvirt-daemon-driver-lxc. How to Install libjasper-dev software package in Ubuntu 17.04 (Zesty Zapus) libjasper-dev software package provides Development files for the JasPer JPEG-2000 library, you can install in your Ubuntu 17.04 (Zesty Zapus) by running the commands given below on the terminal. Dep: libcurl3 (= 7.47.0-1ubuntu2) not amd64, i386 easy-to-use client-side URL transfer library (OpenSSL flavour) dep: libcurl3 (= 7.47.0-1ubuntu2.18) amd64, i386 sug: libcurl3-dbg debugging symbols for libcurl (OpenSSL, GnuTLS and NSS flavours).
If you already have libc++ installed you can use it with clang.
On macOS and FreeBSD libc++ is the default standard libraryand the -stdlib=libc++
is not required. Free ecu flash software download.
If you want to select an alternate installation of libc++ youcan use the following options.
The option -Wl,-rpath,/lib
adds a runtime librarysearch path. Meaning that the systems dynamic linker will look for libc++ in/lib
whenever the program is run. Alternatively theenvironment variable LD_LIBRARY_PATH
(DYLD_LIBRARY_PATH
on macOS) canbe used to change the dynamic linkers search paths after a program is compiled.
An example of using LD_LIBRARY_PATH
:
Prior to LLVM 9.0, libc++ provides the implementation of the filesystem libraryin a separate static library. Users of and
are required to link
-lc++fs
. Prior to libc++ 7.0, users of were required to link libc++experimental.
Starting with LLVM 9.0, support for is provided in the mainlibrary and nothing special is required to use
.
Libc++ provides implementations of experimental technical specificationsin a separate library, libc++experimental.a
. Users of headers may be required to link
-lc++experimental
.
Libc++experimental.a may not always be available, even when libc++ is alreadyinstalled. For information on building libc++experimental from source seeBuilding Libc++ andlibc++experimental CMake Options.
Also see the Experimental Library Implementation Statuspage.
Warning
- The contents of the
headers and
libc++experimental.a
library will not remain compatible between versions. - No guarantees of API or ABI stability are provided.
- When we implement the standardized version of an experimental feature,the experimental feature is removed two releases after the non-experimentalversion has shipped. The full policy is explained here.
On Linux libc++ can typically be used with only ‘-stdlib=libc++'. Howeversome libc++ installations require the user manually link libc++abi themselves.If you are running into linker errors when using libc++ try adding ‘-lc++abi'to the link line. For example:
Alternately, you could just add libc++abi to your libraries list, which inmost situations will give the same result:
GCC does not provide a way to switch from libstdc++ to libc++. You must manuallyconfigure the compile and link commands.
In particular you must tell GCC to remove the libstdc++ include directoriesusing -nostdinc++
and to not link libstdc++.so using -nodefaultlibs
.
Note that -nodefaultlibs
removes all of the standard system libraries andnot just libstdc++ so they must be manually linked. For example:
GDB does not support pretty-printing of libc++ symbols by default. Unfortunatelylibc++ does not provide pretty-printers itself. However there are 3rdparty implementations available and although they are not officiallysupported by libc++ they may be useful to users.
Known 3rd Party Implementations Include:
- Koutheir's libc++ pretty-printers.
Libc++ provides a number of configuration macros which can be used to enableor disable extended libc++ behavior, including enabling 'debug mode' orthread safety annotations.
std::mutex
and std::lock_guard
. By default these annotations aredisabled and must be manually enabled by the user.This macro is used to re-enable an extension in std::tuple which allowedit to be implicitly constructed from fewer initializers than containedelements. Elements without an initializer are default constructed. For example:
Since libc++ 4.0 this extension has been disabled by default. This macromay be defined to re-enable it in order to support existing code that dependson the extension. New use of this extension should be discouraged.See PR 27374 for more information.
Note: The 'reduced-arity-initialization' extension is still offered but onlyfor explicit conversions. Example:
This macro disables the additional diagnostics generated by libc++ using thediagnose_if attribute. These additional diagnostics include checks for:
- Giving set, map, multiset, multimap and their unordered_counterparts a comparator which is not const callable.
- Giving an unordered associative container a hasher that is not constcallable.
Microsoft's C and C++ headers are fairly entangled, and some of their C++headers are fairly hard to avoid. In particular, vcruntime_new.h gets pulledin from a lot of other headers and provides definitions which clash withlibc++ headers, such as nothrow_t (note that nothrow_t is a struct, sothere's no way for libc++ to provide a compatible definition, since you can'thave multiple definitions).
By default, libc++ solves this problem by deferring to Microsoft's vcruntimeheaders where needed. However, it may be undesirable to depend on vcruntimeheaders, since they may not always be available in cross-compilation setups,or they may clash with other headers. The _LIBCPP_NO_VCRUNTIME macroprevents libc++ from depending on vcruntime headers. Consequently, it alsoprevents libc++ headers from being interoperable with vcruntime headers (fromthe aforementioned clashes), so users of this macro are promising to notattempt to combine libc++ headers with the problematic vcruntime headers. Thismacro also currently prevents certain operator new/operator deletereplacement scenarios from working, e.g. replacing operator new andexpecting a non-replaced operator new[] to call the replaced operator new.
Libxerces-c-dev
[[nodiscard]]
attributes to entities not specifiedas [[nodiscard]]
by the current language dialect. This includesbackporting applications of [[nodiscard]]
from newer dialects andadditional extended applications at the discretion of the library. Alladditional applications of [[nodiscard]]
are disabled by default.See Extended Applications of [[nodiscard]] formore information.Known 3rd Party Implementations Include:
- Koutheir's libc++ pretty-printers.
Libc++ provides a number of configuration macros which can be used to enableor disable extended libc++ behavior, including enabling 'debug mode' orthread safety annotations.
std::mutex
and std::lock_guard
. By default these annotations aredisabled and must be manually enabled by the user.This macro is used to re-enable an extension in std::tuple which allowedit to be implicitly constructed from fewer initializers than containedelements. Elements without an initializer are default constructed. For example:
Since libc++ 4.0 this extension has been disabled by default. This macromay be defined to re-enable it in order to support existing code that dependson the extension. New use of this extension should be discouraged.See PR 27374 for more information.
Note: The 'reduced-arity-initialization' extension is still offered but onlyfor explicit conversions. Example:
This macro disables the additional diagnostics generated by libc++ using thediagnose_if attribute. These additional diagnostics include checks for:
- Giving set, map, multiset, multimap and their unordered_counterparts a comparator which is not const callable.
- Giving an unordered associative container a hasher that is not constcallable.
Microsoft's C and C++ headers are fairly entangled, and some of their C++headers are fairly hard to avoid. In particular, vcruntime_new.h gets pulledin from a lot of other headers and provides definitions which clash withlibc++ headers, such as nothrow_t (note that nothrow_t is a struct, sothere's no way for libc++ to provide a compatible definition, since you can'thave multiple definitions).
By default, libc++ solves this problem by deferring to Microsoft's vcruntimeheaders where needed. However, it may be undesirable to depend on vcruntimeheaders, since they may not always be available in cross-compilation setups,or they may clash with other headers. The _LIBCPP_NO_VCRUNTIME macroprevents libc++ from depending on vcruntime headers. Consequently, it alsoprevents libc++ headers from being interoperable with vcruntime headers (fromthe aforementioned clashes), so users of this macro are promising to notattempt to combine libc++ headers with the problematic vcruntime headers. Thismacro also currently prevents certain operator new/operator deletereplacement scenarios from working, e.g. replacing operator new andexpecting a non-replaced operator new[] to call the replaced operator new.
Libxerces-c-dev
[[nodiscard]]
attributes to entities not specifiedas [[nodiscard]]
by the current language dialect. This includesbackporting applications of [[nodiscard]]
from newer dialects andadditional extended applications at the discretion of the library. Alladditional applications of [[nodiscard]]
are disabled by default.See Extended Applications of [[nodiscard]] formore information.[[nodiscard]]
to entitiespurely as an extension. See Extended Applications of [[nodiscard]]for more information.- _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES:
- This macro is used to re-enable all the features removed in C++17. The effectis equivalent to manually defining each macro listed below.
- _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS:
- This macro is used to re-enable the set_unexpected, get_unexpected, andunexpected functions, which were removed in C++17.
- _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR:
- This macro is used to re-enable std::auto_ptr in C++17.
- _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17:
- This macro can be used to disable diagnostics emitted from functions marked
[[nodiscard]]
in dialects after C++17. See Extended Applications of [[nodiscard]]for more information.
This section documents various extensions provided by libc++, how they'reprovided, and any information regarding how to use them.
The [[nodiscard]]
attribute is intended to help users find bugs wherefunction return values are ignored when they shouldn't be. After C++17 theC++ standard has started to declared such library functions as [[nodiscard]]
.However, this application is limited and applies only to dialects after C++17.Users who want help diagnosing misuses of STL functions may desire a moreliberal application of [[nodiscard]]
.
For this reason libc++ provides an extension that does just that! Theextension must be enabled by defining _LIBCPP_ENABLE_NODISCARD
. The extendedapplications of [[nodiscard]]
takes two forms:
- Backporting
[[nodiscard]]
to entities declared as such by thestandard in newer dialects, but not in the present one. - Extended applications of
[[nodiscard]]
, at the libraries discretion,applied to entities never declared as such by the standard.
Users may also opt-out of additional applications [[nodiscard]]
usingadditional macros.
Applications of the first form, which backport [[nodiscard]]
from a newerdialect may be disabled using macros specific to the dialect it was added. Forexample _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
.
Libxerces
Applications of the second form, which are pure extensions, may be disabledby defining _LIBCPP_DISABLE_NODISCARD_EXT
.
This section lists all extended applications of [[nodiscard]]
to entitieswhich no dialect declares as such (See the second form described above).
adjacent_find
all_of
any_of
binary_search
clamp
count_if
count
equal_range
equal
find_end
find_first_of
find_if_not
find_if
find
get_temporary_buffer
includes
is_heap_until
is_heap
is_partitioned
is_permutation
is_sorted_until
is_sorted
lexicographical_compare
lower_bound
max_element
max
min_element
min
minmax_element
minmax
mismatch
none_of
remove_if
remove
search_n
search
unique
upper_bound
lock_guard
's constructors