[Trilinos-Users] problem with Teuchos arrays of type bool

Kurtis Nusbaum klnusbaum at gmail.com
Sat Jun 6 15:24:50 MDT 2009


I'm having trouble compiling some code using a Teuchos::Array<bool>. Here's
the problem.

Code for main.cpp:
.....
12  Teuchos::Array<bool> testBoolArray;
13  testBoolArray.push_back(true);
14  testBoolArray.push_back(false);
15  testBoolArray.push_back(true);
16  testBoolArray.push_back(false);
17  std::string test = testBoolArray.toString();
....

This code generates the following compile time error:

g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB
-DQT_CORE_LIB -DQT_SHARED -I../../qt4.5/mkspecs/linux-g++-64 -I.
-I../../qt4.5/include/QtCore -I../../qt4.5/include/QtGui
-I../../qt4.5/include -I. -I. -I. -I.
-I/net/home/f07/klnusbau/trilinos9/stratdebugBuild/include -o main.o
main.cpp
/net/home/f07/klnusbau/trilinos9/stratdebugBuild/include/Teuchos_ArrayRCP.hpp:
In function ‘Teuchos::ArrayRCP<const T> Teuchos::arcp(const
Teuchos::RCP<const std::vector<T, std::allocator<_CharT> > >&) [with T =
bool]’:
/net/home/f07/klnusbau/trilinos9/stratdebugBuild/include/Teuchos_Array.hpp:761:
instantiated from ‘typename Teuchos::Array<T>::const_iterator
Teuchos::Array<T>::begin() const [with T = bool]’
/net/home/f07/klnusbau/trilinos9/stratdebugBuild/include/Teuchos_Array.hpp:1191:
instantiated from ‘Teuchos::ArrayView<const T>
Teuchos::Array<T>::view(Teuchos_Index, Teuchos_Index) const [with T = bool]’
/net/home/f07/klnusbau/trilinos9/stratdebugBuild/include/Teuchos_Array.hpp:1231:
instantiated from ‘Teuchos::ArrayView<const T>
Teuchos::Array<T>::operator()() const [with T = bool]’
/net/home/f07/klnusbau/trilinos9/stratdebugBuild/include/Teuchos_Array.hpp:1109:
instantiated from ‘std::string Teuchos::Array<T>::toString() const [with T =
bool]’
main.cpp:17:   instantiated from here
/net/home/f07/klnusbau/trilinos9/stratdebugBuild/include/Teuchos_ArrayRCP.hpp:814:
error: lvalue required as unary ‘&’ operand

I am at an absolute loss. If I do the exact same thing but just use a
different data type like int instead of bool everything works just fine. Any
ideas?

-Kurtis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20090606/d8e3356f/attachment.html 


More information about the Trilinos-Users mailing list