[CppAD] operator>>( istream , AD<double> )

Brad Bell bradbell at seanet.com
Sun Dec 30 22:07:36 EST 2012


I checked in some changes to support the operation
     cin >> x
where cin is an istream and x is an AD<Base> (provided that Base 
supports the operation). See
     https://projects.coin-or.org/CppAD/changeset/2692

I am currently modifying the method whereby the documentation and 
tarballs are built early each morning. If it works, tomorrow morning, 
the corresponding version of CppAD will be
     cppad-20121230

Until it does work,you can use subversion to download the most recent 
version of the trunk which supports this operation; see
     http://www.coin-or.org/CppAD/Doc/download.htm#Subversion

Brad.

On 12/30/2012 03:11 PM, Norman Goldstein wrote:
> I would find it convenient to write code like:
>
> #include <iostream>
> CppAD::AD<double> x;
> std::cin >> x;
>
> but I get the error
>
> //============ Error from compilier ====================
> tcppad.cpp:70:14: error: cannot bind ‘std::istream {aka 
> std::basic_istream<char>}’ lvalue to ‘std::basic_istream<char>&&’
> In file included from 
> /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iostream:41:0,
> from /home/work/SRC/source/SVN_src/dev/src/test/tcppad.cpp:1:
> /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/istream:866:5: 
> error: initializing argument 1 of ‘std::basic_istream<_CharT, 
> _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) 
> [with _CharT = char; _Traits = std::char_traits<char>; _Tp = 
> CppAD::AD<double>]’
> //==============================================
>
> Is there a header I should be using? Or is this code not a good idea?
>
> I am using
> g++ -std=c++0x ...
>
> on Fedora 17, 32-bit, x86
>
> Thank you.
>
> _______________________________________________
> CppAD mailing list
> CppAD at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cppad
>



More information about the CppAD mailing list