X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FProgrammersManual.rst;h=46ec15f93a3236a65079e88254eb4f21704bee71;hb=0e9c68e6bc8768143308b0162e900ba8bd10dc01;hp=b35364d06a878d61e665530fa6aaa517c089f874;hpb=4641b6b42730f4e8542a1e96d77047fd903d97ad;p=oota-llvm.git diff --git a/docs/ProgrammersManual.rst b/docs/ProgrammersManual.rst index b35364d06a8..46ec15f93a3 100644 --- a/docs/ProgrammersManual.rst +++ b/docs/ProgrammersManual.rst @@ -298,7 +298,9 @@ The ``function_ref`` (`doxygen `__) class template represents a reference to a callable object, templated over the type of the callable. This is a good choice for passing a callback to a function, -if you don't need to hold onto the callback after the function returns. +if you don't need to hold onto the callback after the function returns. In this +way, ``function_ref`` is to ``std::function`` as ``StringRef`` is to +``std::string``. ``function_ref`` can be implicitly constructed from any callable object that can be called with arguments of type ``Param1``, @@ -323,17 +325,11 @@ can be called using: return false; }); -Note that a ``function_ref`` object contains pointers to external memory, so -it is not generally safe to store an instance of the class (unless you know -that the external storage will not be freed). -``function_ref`` is small enough that it should always be passed by value. - -``std::function`` -^^^^^^^^^^^^^^^^^ - -You cannot use ``std::function`` within LLVM code, because it is not supported -by all our target toolchains. - +Note that a ``function_ref`` object contains pointers to external memory, so it +is not generally safe to store an instance of the class (unless you know that +the external storage will not be freed). If you need this ability, consider +using ``std::function``. ``function_ref`` is small enough that it should always +be passed by value. .. _DEBUG: @@ -1441,8 +1437,10 @@ order, making it an easy (but somewhat expensive) solution for non-deterministic iteration over maps of pointers. It is implemented by mapping from key to an index in a vector of key,value -pairs. This provides fast lookup and iteration, but has two main drawbacks: The -key is stored twice and it doesn't support removing elements. +pairs. This provides fast lookup and iteration, but has two main drawbacks: +the key is stored twice and removing elements takes linear time. If it is +necessary to remove elements, it's best to remove them in bulk using +``remove_if()``. .. _dss_inteqclasses: @@ -2177,6 +2175,7 @@ Ending Execution with ``llvm_shutdown()`` When you are done using the LLVM APIs, you should call ``llvm_shutdown()`` to deallocate memory used for internal structures. + .. _managedstatic: Lazy Initialization with ``ManagedStatic``