Re: C++11 move constructors



On 23 November 2012 19:50, Tristan Matthews <le businessman gmail com> wrote:
> 2012/11/23 Murray Cumming <murrayc murrayc com>:
>> Maybe we could add C++11 move constructors to the gtkmm classes, where appropriate, inside ifdefs to prevent them from breaking the build when C++11 is not enabled/supported by the compiler.
>
> How would you test for C++11? An AC_COMPILE_IFELSE test that builds a
> class with a move constructor?

That is what I am doing for other C++11 features in my projects (see
https://github.com/rhdunn/cainteoir-engine/blob/master/m4/cxx11.m4).
For example:

AC_DEFUN([CXX11_AUTO], [
AC_LANG_PUSH(C++)
AC_MSG_CHECKING([if $CXX supports C++11 auto])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[class A {} a;]
[auto b = a;]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([C++11 auto not supported by $CXX.])])
AC_LANG_POP(C++)])

Feel free to use & improve.

- Reece


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]