source: trunk/bug/std_vector.sh @ 2935

Last change on this file since 2935 was 2935, checked in by bradbell, 7 years ago

check_svn_id.sh: Ignore bug/build directory.
std_vector.sh: Add copyright message.
rev_sparse_hes.cpp: Fix problem on OSX systems.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1#! /bin/bash -e
2# $Id: std_vector.sh 2935 2013-10-12 19:40:01Z bradbell $
3# -----------------------------------------------------------------------------
4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
5#
6# CppAD is distributed under multiple licenses. This distribution is under
7# the terms of the
8#                     Eclipse Public License Version 1.0.
9#
10# A copy of this license is included in the COPYING file of this distribution.
11# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
12# -----------------------------------------------------------------------------
13# Using g++ 4.8.1 results in the following error message:
14#
15# std_vector.cpp:8:7: error: no match for ‘operator|=’ (operand types are
16# ‘std::vector<bool>::reference {aka std::_Bit_reference}’ and ‘bool’)
17#  y[1] |= true;
18#       ^
19# -----------------------------------------------------------------------------
20if [ ! -e build ]
21then
22        mkdir build
23fi
24cd build
25echo "$0"
26name=`echo $0 | sed -e 's|.*/||' -e 's|\..*||'`
27cat << EOF > $name.cpp
28# include <vector>
29int main(void)
30{       int N = 1;
31        std::vector<bool> y(N);
32        for(int i = 0; i < N; i++ )
33                y[i] = false;
34        y[0]  = y[0] | true;
35        y[1] |= true;
36        return 0;
37}
38EOF
39echo "g++ -g $name.cpp -o $name"
40g++ -g $name.cpp -o $name
41#
42echo "./$name"
43./$name
44#
45echo "rm $name $name.cpp"
46rm $name $name.cpp
Note: See TracBrowser for help on using the repository browser.